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

C Programming Revision

The document provides a concise overview of C programming, covering data types such as int, char, float, and double, as well as derived types like arrays and pointers. It explains logical operators (AND, OR, NOT), arithmetic operators (addition, subtraction, etc.), and control statements including if-else, switch-case, and loops. Examples are provided to illustrate the usage of these concepts.

Uploaded by

tx076876
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)
2 views2 pages

C Programming Revision

The document provides a concise overview of C programming, covering data types such as int, char, float, and double, as well as derived types like arrays and pointers. It explains logical operators (AND, OR, NOT), arithmetic operators (addition, subtraction, etc.), and control statements including if-else, switch-case, and loops. Examples are provided to illustrate the usage of these concepts.

Uploaded by

tx076876
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/ 2

C Programming Revision Notes

1. Data Types in C
C has several data types:
- int: Stores integers (4 bytes, e.g., 10, -5).
- char: Stores a single character (1 byte, e.g., 'A').
- float: Stores decimal numbers (4 bytes, e.g., 3.14).
- double: Stores large decimal numbers (8 bytes).
- Derived types: Arrays, Pointers, Structures, Unions.

2. Logical Operators
Logical operators are used to combine conditions:
- && (AND): True if both conditions are true.
- || (OR): True if at least one condition is true.
- ! (NOT): Reverses the condition (true -> false).

Example:
if (a > 0 && b > 0) {
printf("Both are positive");
}

3. Arithmetic Operators
Used for mathematical calculations:
- + (Addition)
- - (Subtraction)
- * (Multiplication)
- / (Division)
- % (Modulus, remainder)

Example:
int a = 10, b = 5;
printf("Sum: %d", a + b); // Output: 15
4. Control Statements
Used to control program flow.

- if-else:
if (x > 0) {
printf("Positive");
} else {
printf("Not positive");
}

- switch-case:
switch(day) {
case 1: printf("Monday"); break;
case 2: printf("Tuesday"); break;
default: printf("Invalid");
}

- Loops:
for (int i = 0; i < 5; i++) { printf("%d", i); }
while (i < 5) { printf("%d", i); i++; }
do { printf("%d", i); i++; } while (i < 5);

You might also like