diff --git a/cv1/program.c b/cv1/program.c index be31ec9..69dddbf 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -54,7 +54,12 @@ int read_pizza(struct pizza *item) { return 0; } - item->price = strtof(line, NULL); + char *endptr; + item->price = strtof(line, &endptr); + if (endptr == line || *endptr != '\n') { + return 0; + } + return 1; }