Programming in C – Diploma Students Study Material
1. Introduction to C Developed by Dennis Ritchie at AT&T; Bell Labs (1972). General purpose,
structured, middle-level language. Used in system programming, operating systems, embedded
systems, and application development.
2. Features of C
1. Simple & Efficient 2. Fast Execution 3. Structured Programming Language 4. Rich Library
Functions 5. Machine Independent (Portable) 6. Low-level + High-level capabilities 7. Easy to
Extend
3. Basic Elements of C
- Character Set - Identifiers - Keywords - Constants - Variables - Operators (+, -, *, /, %) - Data
Types: int, float, double, char, void
4. Structure of a C Program
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
5. Input & Output Functions
#include <stdio.h>
int main() {
int age;
printf("Enter your age: ");
scanf("%d", &age);
printf("You are %d years old", age);
return 0;
}
6. Control Statements
if(condition) {
// code
} else {
// code
}
#include <stdio.h>
int main() {
for(int i=1; i<=5; i++) {
printf("%d\n", i);
}
return 0;
}
7. Functions in C
#include <stdio.h>
int add(int a, int b) {
return a+b;
}
int main() {
1. Introduction to C Developed by Dennis Ritchie at AT&T; Bell Labs (1972). General purpose,
structured, middle-level language. Used in system programming, operating systems, embedded
systems, and application development.
2. Features of C
1. Simple & Efficient 2. Fast Execution 3. Structured Programming Language 4. Rich Library
Functions 5. Machine Independent (Portable) 6. Low-level + High-level capabilities 7. Easy to
Extend
3. Basic Elements of C
- Character Set - Identifiers - Keywords - Constants - Variables - Operators (+, -, *, /, %) - Data
Types: int, float, double, char, void
4. Structure of a C Program
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
5. Input & Output Functions
#include <stdio.h>
int main() {
int age;
printf("Enter your age: ");
scanf("%d", &age);
printf("You are %d years old", age);
return 0;
}
6. Control Statements
if(condition) {
// code
} else {
// code
}
#include <stdio.h>
int main() {
for(int i=1; i<=5; i++) {
printf("%d\n", i);
}
return 0;
}
7. Functions in C
#include <stdio.h>
int add(int a, int b) {
return a+b;
}
int main() {