0% found this document useful (0 votes)
36 views2 pages

Introduction To C

Uploaded by

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

Introduction To C

Uploaded by

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

1.

Introduction to C:
C is a general-purpose, procedural programming language developed by Dennis Ritchie
in 1972.
It is known for its efficiency and is widely used for system programming,
developing operating systems, embedded systems, etc.
C is a compiled language, and the source code is converted into machine code using
compilers.
2. Basic Syntax:
Every C program starts with the main() function.
c
Copy code
int main() {
return 0;
}
Semicolons ; are used to terminate statements.
Curly braces {} define the beginning and end of code blocks.
3. Data Types:
Primary Data Types: int, float, char, double.
c
Copy code
int age = 22;
char grade = 'A';
float temperature = 36.6;
Derived Data Types: Arrays, pointers, structures.
Void: Special type that signifies "no type," often used in functions.
4. Variables and Constants:
Variables: Must be declared before use.
c
Copy code
int a = 10;
Constants: Defined using #define or const.
c
Copy code
#define PI 3.14
const int AGE = 25;
5. Operators:
Arithmetic Operators: +, -, *, /, %.
Relational Operators: ==, !=, <, >, <=, >=.
Logical Operators: && (AND), || (OR), ! (NOT).
Assignment Operators: =, +=, -=, *=, /=.
Increment/Decrement Operators: ++ and --.
6. Control Structures:
If-Else Statements:
c
Copy code
if (a > 10) {
printf("Greater than 10");
} else {
printf("Less or equal to 10");
}
Switch Statements:
c
Copy code
switch (a) {
case 1:
printf("One");
break;
case 2:
printf("Two");
break;
default:
printf("Not One or Two");
}
Loops:
For Loop:
c
Copy code
for (int i = 0; i < 5; i++) {
printf("%d\n", i);
}
While Loop:
c
Copy code
int i = 0;
while (i < 5) {
printf("%d\n", i);
i++;
}
Do-While Loop:
c
Copy code
int i = 0;
do {
printf("%d\n", i);
i++;
} while (i < 5);
7. Functions:

You might also like