A curated list of progressively challenging C problems to build true low-level mastery — from pointers and arrays to dynamic memory, data structures, and system programming.
Goal: Understand arrays, pointers, and basic string manipulation.
- Implement
strlenmanually - Implement
strcpymanually - Reverse a string in place
- Swap array of integers using pointers
- Find max/min in an integer array using pointers
- Implement
strcmpmanually - Implement your own
strchr(find first char in string) - Reverse an integer array in place
- Implement
memcpymanually - Count vowels and consonants in a string
Goal: Learn heap allocation, resizing, and memory safety.
- Dynamically allocate an integer array and fill it
- Implement your own
strdup - Concatenate two strings using
malloc - Resize an any T array using
realloc - Build a dynamic array (push/pop/resize)
- Demonstrate shallow vs deep copy of a struct
Goal: Model data in memory with structs and pointers.
- Define a
struct Point { int x, y; }and compute distance - Create a
struct Personwith dynamically allocatedchar* name
- Implement a singly linked list (insert/delete/print)
- Reverse a linked list iteratively
- Implement a doubly linked list
- Detect a cycle in a linked list (Floyd’s algorithm)
- Merge two sorted linked lists
- Define a
struct Nodefor a binary tree (data,left,right) - Implement preorder, inorder, and postorder traversals (recursive)
- Implement level-order traversal (using a queue)
- Find height and number of nodes in a binary tree
- Insert and search in a Binary Search Tree (BST)
- Delete a node in a BST
- Represent a graph using adjacency list
- Implement Breadth-First Search (BFS)
- Implement Depth-First Search (DFS)
- Detect a cycle in a directed graph
- Find connected components in an undirected graph
- Implement Dijkstra’s shortest path algorithm
Goal: Handle persistent data and understand file buffers.
- Count lines, words, and characters in a file
- Copy one file into another (byte by byte)
- Recreate the
catcommand (print file contents) - Append text to a file using
fopenin append mode - Read a file into a dynamically allocated string buffer
Goal: Think in bits and bytes like hardware.
- Check if a number is odd or even using bitwise AND
- Count number of set bits in an integer
- Swap two numbers without a temp variable
- Extract specific bits from a byte
- Reverse the bits of a byte
- Pack four bytes into one 32-bit integer, then unpack them
Goal: Combine all knowledge into real programs.
- Implement
atoi(string to int) - Implement
itoa(int to string) - Build a mini command-line calculator
- Implement a hash table with collision handling
- Create your own simplified
printffor strings/ints - Implement a memory pool allocator
- Build a ring buffer for UART-like data
- Use function pointers to build a callback system
- Simulate a basic shell (parse + execute commands)
Goal: Practice concepts crucial for embedded and systems interviews.
- Implement a finite state machine (traffic light controller)
- Simulate GPIO register toggling using bit manipulation
- Create a mock UART ring buffer with push/pop
- Debounce a button press in software
- Simulate an interrupt-safe queue with atomic flag handling
- 🧩 Start with Phase 1, do 2–3 problems per session.
- 💾 Use
valgrindto check for memory leaks in dynamic problems. - 🧱 Print pointer addresses and array indices often — understand why data sits where it does.
- 💬 Adapt and extend the problems — try different data types, edge cases, and constraints.
✅ By the end of this list, you’ll have implemented strings, memory allocators, linked lists, trees, graphs, and system-level utilities — the full toolset of a real C engineer.