C Example: CSV Reader: skip header, parse rows, aggregate totals
Generates a four-row product CSV, skips the header, then uses sscanf with %[^,] for the name, %d for quantity and %lf for unit price; prints each row and accumulates total quantity and value. Shows the most common field-splitting and type-conversion combination in CSV parsing.
🖥 Run OnlineGCC 10.2 · C11 standard · click ▶ to run · Copy code
🖨 Reference OutputMatches the online run in a standard C11 environment
item qty price keyboard 12 89.00 hub 5 34.50 monitor 3 219.00 stand 8 29.90 rows=4 total_qty=28 total_value=2136.70
🧩 Keep Learning