Problem Solving Using C – Exam Preparation
Notes
Introduction to C
C is a structured, procedural programming language developed by Dennis Ritchie. It is widely used
for system programming, embedded systems, and application development.
Basic Structure of C Program
Include header files, main() function, variable declaration, statements, and return statement.
Data Types
int, float, double, char, void. Used to define the type of data a variable can store.
Operators
Arithmetic, Relational, Logical, Assignment, Increment/Decrement, Conditional operators.
Control Statements
Decision making: if, if-else, switch. Looping: for, while, do-while.
Arrays
Collection of elements of same data type stored in contiguous memory locations.
Functions
Block of code that performs a specific task. Improves modularity and reusability.
Pointers
Variables that store the address of another variable. Used for dynamic memory and arrays.
Structures
User-defined data type to store different data types under one name.
File Handling
Used to store data permanently using files. fopen(), fclose(), fprintf(), fscanf().
Problem Solving Steps
Understand problem, design algorithm, write pseudocode, implement in C, test and debug.