Skip to the task
Layout
Back to classic view

You are looking at lesson 9. Your place is still Practice test 2, task 1: About.

CHECKTask 16 of 20 · step 7: Drills: check yourself

strtol and garbage at the end

What does strtol return, and where does end point?

char *end;
long x = strtol("  15kg", &end, 10);
Stuck?

x = 15, end points to "kg". read_int wouldn't accept such a line.