C - Detailed Notes
Introduction
C is a procedural, low-level programming language. It provides direct access to memory and
system resources. It is widely used in operating systems, embedded systems, and
performance-critical applications.
Basic Syntax
Hello World
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
Variables & Data Types
int age = 21;
float pi = 3.14;
char grade = 'A';
Control Structures
int x = 10;
if (x > 0) printf("Positive");
else if (x == 0) printf("Zero");
else printf("Negative");
Loops
for(int i=0;i<5;i++) printf("%d", i);
while(x>0){ printf("%d", x); x--; }
Functions
int add(int a, int b){ return a+b; }
Pointers & Memory
int n=10; int *p = &n;
printf("%d", *p);
Applications
- OS kernels (Linux, Windows parts)
- Embedded systems
- Compilers
Summary
C is efficient and close to hardware, forming the foundation of modern languages.