Work through focused C exercises from approachable foundations to more demanding problem-solving patterns.
Start with one core idea at a time and make the basic moves feel automatic.
Return the number of English vowels in a null-terminated string. Count upper- and lower-case letters, and treat a null pointer as an empty string.
Implement find_max to write the greatest array value into out. Return 1 on success and 0 when the array is empty, the pointer is null, or out is null.
Implement sum_array so it returns the sum of exactly length elements. The caller owns the array; handle a null pointer or zero length without dereferencing it.
Implement swap_ints so the caller's two integer variables exchange values. It must do nothing when either pointer is null.
Combine concepts, validate inputs, and make practical design decisions.
Write copy_string that copies source into destination when capacity is non-zero, always terminates the destination, and reports failure if the source will not fit.
Remove duplicates in-place from an ascending integer array and return the number of unique values. The retained prefix must preserve ascending order.
Implement append_int so a heap-backed buffer grows geometrically, checks multiplication overflow, and leaves the original allocation untouched if realloc fails.
Work with edge cases, maintainability, and the tradeoffs found in production code.
Given app.c, inventory.c, inventory.h, and Makefile, explain and write the dependency rules needed so changing inventory.h recompiles both relevant object files before linking.
Parse a simple inventory record in the form id,name,quantity into a struct. Reject missing fields, extra commas, an empty name, and a quantity outside 0..100000.
Implement queue_push for a fixed-capacity circular queue. Return 0 when the queue is full or invalid; otherwise store the value, advance tail with wraparound, and increase size.
Return to the free lessons, editable examples, and quick checks whenever an exercise exposes a gap.
Implement parse_quantity using strtol. Accept only a complete base-10 integer in range 0..100000, reject whitespace-only or trailing characters, and report success through the return value.