C Programming – Complete Notes
Notebook-style notes covering Functions, Pointers, Arrays, Structures, Dynamic Memory
Allocation, Recursion and more. Useful for VTU Internals & Semester Exams.
1. Functions in C
A function is a self-contained block of code that performs a specific task. Functions improve
modularity, readability, and reusability of programs.
2. Function Parameters
Formal parameters are variables defined in the function definition. Actual parameters are values
passed during the function call.
3. Command Line Arguments (argc & argv)
Command line arguments allow data to be passed to the program at runtime using argc
(argument count) and argv (argument vector).
4. Function Categories
Functions can be categorized based on arguments and return values: No arguments-no return,
arguments-no return, no arguments-return value, arguments-return value.
5. Pointers
A pointer is a variable that stores the address of another variable. Pointers enable dynamic
memory allocation and efficient data handling.
6. Pointer to Pointer
A pointer can store the address of another pointer. This is known as multiple indirection.
7. Arrays and Functions
Arrays can be passed to functions by passing the base address of the array.
8. Dynamic Memory Allocation
Dynamic memory allocation is done using malloc(), calloc(), realloc(), and free() functions.
9. Call by Value & Call by Reference
Call by value passes a copy of the variable. Call by reference passes the address, allowing
modification of original data.
10. Recursion
Recursion is a technique where a function calls itself until a base condition is met.
11. Structures
Structures allow grouping of different data types under one name. Arrays of structures and
nested structures are commonly used.
12. Enumeration
Enumeration is a user-defined data type consisting of named integer constants.