A collection of C programming exercises covering arrays, pointers, dynamic memory allocation, and string manipulation.
This repository contains solutions to 10 practical problems designed to reinforce core C programming concepts, including:
- Array traversal and manipulation
- Pointer arithmetic
- Dynamic memory allocation (
malloc/new) and deallocation - String processing with pointers
- Searching, sorting, and merging algorithms
| # | Title | Concepts Covered |
|---|---|---|
| 1 | Count Even and Odd Numbers | Arrays, loops, conditionals |
| 2 | Linear Search | Arrays, function return values |
| 3 | Descending Range Array (Dynamic) | Dynamic memory allocation, error checking |
| 4 | Swap Middle Characters | Strings, function parameters |
| 5 | Modify Values Using Pointers | Pointers, pass-by-reference |
| 6 | Reverse Array (Dynamic + Pointers) | Dynamic memory, pointer arithmetic |
| 7 | Replace Vowels with * |
Strings, pointer dereferencing |
| 8 | Merge and Sort Two Arrays | Dynamic memory, sorting algorithms |
| 9 | Swap First and Last Elements | Arrays, pointers |
| 10 | Print All Substrings of Length 3 | Strings, pointer traversal |
- A C compiler (GCC recommended)
- Terminal / command line access
Each practical is contained in its own .c file. To compile and run:
gcc practical_01.c -o practical_01
./practical_01Replace practical_01 with the relevant file name for each exercise.
c-programming-practicals/
├── practical_01_even_odd_count.c
├── practical_02_linear_search.c
├── practical_03_descending_range.c
├── practical_04_swap_middle_chars.c
├── practical_05_modify_pointers.c
├── practical_06_reverse_array.c
├── practical_07_replace_vowels.c
├── practical_08_merge_sort_arrays.c
├── practical_09_swap_first_last.c
├── practical_10_substrings_length3.c
└── README.md
- All programs handle user input as specified in each problem statement.
- Programs involving dynamic memory allocation check for allocation failures and free all allocated memory before exiting.
- Code is commented to explain key logic, especially around pointer arithmetic and memory management.
Nasim Bidel