This repository contains a comprehensive collection of C programming practice questions that I have solved while preparing for my C Programming examination.
The programs cover concepts ranging from basic syntax to advanced topics such as structures, unions, dynamic memory allocation, file handling, and pointers.
This repository does NOT contain Data Structures and Algorithms (DSA) problems.
All questions focus strictly on fundamental C programming concepts.
I am sharing this collection so that other students can also practice, revise, and prepare effectively for exams, viva, and practical assessments.
-
questions.txt
→ Contains the complete list of C programming questions with program numbers (Program 1 to Program 135). -
Individual C source files
→ Each program is saved separately using the format:
program_no.c
(Example:program_25.c,program_66.c, etc.)
-
Basic Programming Concepts
- Input–Output in C
- Variables and Data Types
- Operators and Expressions
-
Conditional Statements
- If statement
- If–else statement
- Nested if–else
- Switch case statement
-
Looping Constructs
- For loop
- While loop
- Do–while loop
- Nested loops
-
Jump & Loop Control Statements
- Break statement
- Continue statement
- Goto statement
- Infinite loops
-
Mathematical & Logical Programs
- Factorial of a number
- Fibonacci series
- Sum of digits
- Reverse of a number
- Sum of first n natural numbers
- GCD using Euclid’s algorithm
- Prime number checking
- Armstrong number
- Palindrome number
- Perfect number
- Leap year checking
-
Functions
- User-defined functions
- Function with parameters
- Function with return value
- Call by value
- Call by reference
-
Recursion
- Recursive factorial
- Recursive Fibonacci
- Recursive sum of digits
- Recursive reverse of number
- Recursive power calculation
- Recursive prime checking
-
Arrays
- One-dimensional arrays
- Sum and average of array elements
- Reverse of array
- Maximum and minimum in array
- Counting even and odd elements
- Missing number in array
- Searching in array
-
Sorting Algorithms
- Bubble Sort
- Selection Sort
- Insertion Sort
- Quick Sort
- Merge Sort
-
Two-Dimensional Arrays & Matrices
- 2D array basics
- Matrix addition
- Matrix multiplication
- Transpose of matrix
- Searching in 2D array
-
Pattern Printing
- Star patterns
- Number patterns
- Character patterns
- Inverted patterns
- Hollow patterns
- Diamond pattern
- Butterfly pattern
- Pascal’s Triangle
-
Strings
- String basics
- String palindrome
- String reversal
- String comparison
- String copy
- String concatenation
- Anagram checking
- ASCII manipulation (encryption/decryption)
- Substring extraction
-
Structures
- Structure definition and initialization
- Array of structures
- Passing structure to function
- Pointer to structure
- Structure for student records
- Structure for employee records
-
Unions
- Union basics
- Memory sharing in union
- Union inside structure
-
Typedef
- Typedef with basic data type
- Typedef with structure
- Typedef with pointer
-
Enumerations
- Enum basics
- Assigning values to enum constants
- Enum with switch case
-
Storage Classes
- Auto storage class
- Register storage class
- Static variable
- Extern storage class
- Difference between static and non-static
- Scope of variables
- Lifetime of variables
-
Dynamic Memory Allocation
- malloc()
- calloc()
- realloc()
- Dynamic array
- Dynamic string
- Dynamic structure
- Dynamic 2D array
-
Pointers
- Pointer basics
- Pointer arithmetic
- Generic pointer (void *)
- Generic pointer with function
-
Self-Referential Structures
- Self-referential structure basics
- Declaration and initialization
-
File Handling
- File creation
- Writing to file
- Reading from file (character by character)
- Reading using fgets()
- Appending data to file
- Counting characters in file
- Counting lines in file
- Copying file contents
-
Conversion Programs
- Celsius to Fahrenheit
- Fahrenheit to Celsius
- Decimal to binary
-
Simple Application Programs
- Largest of three numbers
- Even or odd
- Grade assignment
- Calculator using switch
- Simple interest
- Compound interest
-
Open the
questions.txtfile- Search for the question you want to practice or revise.
-
Note the Program Number
- Each question is clearly labeled (e.g., Program 45, Program 72).
-
Open the Corresponding C File
- Go to the file named
program_no.c
Example:- For Program 45, open
program_45.c
- For Program 45, open
- Go to the file named
-
Compile and Run the Program
gcc program_45.c ./a.exe
If you found this inspiring or would love to collaborate — let’s connect! 🤝
💻 GitHub: https://github.com/Dhruv-kundu
✉️ Email: kd243315@gmail.com