Skip to the task
Layout
Back to classic view

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

CHECKTask 11 of 17 · step 3: Questions 7–12

NULL checked too late

fopen, then fgets right away, and only then if (f == NULL). What's wrong?

Stuck?

fgets has already got NULL (Linux – Segmentation fault, GitHub CI – UBSan: null pointer passed as argument 3), and fgets's result isn't checked. Check NULL right after fopen. (Topic 11)