0% found this document useful (0 votes)
41 views9 pages

C Language Complete Notes

Uploaded by

chaituabhi16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views9 pages

C Language Complete Notes

Uploaded by

chaituabhi16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

C Language Complete Exam Notes

These notes cover all major topics in C programming for [Link] students. Prepared with examples
and key points for exam preparation.
Unit 1 – Basics of C
Introduction: Developed by Dennis Ritchie in 1972. General-purpose, structured, mid-level
programming language.

Features of C:
• Simple & efficient
• Portable
• Structured programming
• Rich library functions
• Supports low & high-level programming
Structure of a C Program:
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}

Tokens in C:
• Keywords – Reserved words (int, return, if)
• Identifiers – Names of variables/functions
• Constants – Fixed values (10, 'A', 3.14)
• Operators – Symbols for operations (+, -, *)
• Separators – ; , {} () []
Data Types:
• int → 2/4 bytes
• float → 4 bytes
• double → 8 bytes
• char → 1 byte
• void → no value
Unit 2 – Operators & Control Statements
Operators:
• Arithmetic (+, -, *, /, %)
• Relational (==, !=, >, <)
• Logical (&&, ||, !)
• Bitwise (&, |, ^, <<, >>)
• Assignment (=, +=, -=)
• Conditional (?:)
• Increment/Decrement (++/--)
Control Flow:
• if, if-else, nested if
• switch-case
• Loops: for, while, do-while
• Jump: break, continue, goto
Unit 3 – Functions
Functions are blocks of code for reusability.
Types: Library functions (printf, scanf) & User-defined functions

Function Example:
int add(int a, int b) {
return a + b;
}
int main() {
printf("%d", add(3,4));
}
Parameter passing: Call by Value & Call by Reference
Recursion: A function calling itself.
Unit 4 – Arrays & Strings
Arrays: Collection of similar data.
int arr[5] = {1,2,3,4,5};
Strings: Character arrays ending with '\0'.
• strlen()
• strcpy()
• strcat()
• strcmp()
Unit 5 – Pointers
Pointer: A variable storing address of another variable.
int a = 10;
int *p = &a;
printf("%d", *p); // prints 10
Pointer arithmetic, Pointers with arrays, functions, and strings.
Unit 6 – Structures & Unions
Structure Example:
struct student {
int roll;
char name[20];
};
Union: Similar to structures but shares memory.
Difference: Structure stores all members separately; Union shares memory.
Unit 7 – Storage Classes & Preprocessor
Storage Classes:
• auto – default
• static – retains value
• extern – global variable access
• register – fast access
Preprocessor Directives:
• #define – macros
• #include – header files
• #ifdef/#endif – conditional compilation
Unit 8 – File Handling
Files allow storing data permanently.
Important functions: fopen, fclose, fprintf, fscanf, fgetc, fputc
FILE *fp;
fp = fopen("[Link]", "w");
fprintf(fp, "Hello C");
fclose(fp);

You might also like