C Programming Practice Questions & Exercises

Theory without practice will not make you a proficient systems engineer. To truly understand memory management, pointer arithmetic, and algorithmic efficiency, you must write code, trigger compiler diagnostics, and debug edge cases. Here is a progressive set of C programming practice questions designed to take you from core syntax to intermediate data structures.
Tier 1: Number Theory, Math & Loops
1. Reverse an integer without converting it into a string or allocating heap buffers. 2. Determine if a given positive integer is an Armstrong number (Narcissistic number). 3. Compute the prime factorization of a number using trial division in O(sqrt(N)) time. 4. Generate Pascal Triangle rows using dynamically allocated 2D arrays.
Tier 2: Strings & Array Pointer Arithmetic
1. Invert a null-terminated C string in-place using two pointer iterators. 2. Remove all duplicate characters from a string in O(N) time using an ASCII bitmask array. 3. Find the second largest integer in an unsorted array in a single traversal pass. 4. Rotate an N-element array left by K positions in-place with O(1) auxiliary memory.
Tier 3: Dynamic Memory & Linked Lists
1. Implement a singly linked list with push_front, pop_back, and search operations. 2. Reverse a singly linked list in-place by adjusting next pointers without copying nodes. 3. Detect cycles in a linked list using Floyd Tortoise and Hare two-pointer algorithm. 4. Implement a custom dynamic array (vector) that doubles its heap capacity via realloc().
Frequently Asked Questions
Where can I test and compile these practice questions online?
You can write, run, and step-debug every solution directly in our free Online C Compiler IDE, which runs modern GCC inside an isolated cloud sandbox.
How do I debug runtime errors when solving C challenges?
Always compile with GCC diagnostic flags enabled (-Wall -Wextra). If your code terminates unexpectedly with exit code 139, check for NULL pointers or array index out-of-bounds.