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

C Revision Quick Notes

This document is a last-minute revision sheet for C programming, covering essential topics such as program structure, data types, operators, conditional statements, loops, functions, arrays, strings, pointers, structures, and file handling. It provides code snippets and examples for each topic to aid in understanding. The sheet serves as a quick reference guide for key concepts and syntax in C programming.

Uploaded by

army.cutey2006
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)
5 views2 pages

C Revision Quick Notes

This document is a last-minute revision sheet for C programming, covering essential topics such as program structure, data types, operators, conditional statements, loops, functions, arrays, strings, pointers, structures, and file handling. It provides code snippets and examples for each topic to aid in understanding. The sheet serves as a quick reference guide for key concepts and syntax in C programming.

Uploaded by

army.cutey2006
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

C Programming Last-Minute Revision Sheet

1. Structure of C Program
#include<stdio.h>
void main() {
// your code here
}

2. Data Types & Variables


- int → whole numbers
- float → decimal
- char → single character
Use scanf() to take input and printf() to display.

3. Operators
- Arithmetic: +, -, *, /, %
- Relational: ==, !=, >, <
- Logical: &&, ||, !

4. Conditional Statements
if (condition) { ... }
else { ... }

switch(choice) {
case 1: ...; break;
default: ...;
}

5. Loops
for (i=0; i<n; i++) {...}
while (condition) {...}
do {...} while (condition);

6. Functions
int add(int a, int b) {
return a + b;
}

7. Arrays
int a[5] = {1, 2, 3, 4, 5};

8. Strings
char name[20];
scanf("%s", name);
String functions: strlen(), strcpy(), strcmp()

9. Pointers
int a = 10, *p;
p = &a;
printf("%d", *p); // outputs 10

10. Structures
struct Student {
int roll;
char name[20];
};

11. File Handling


FILE *fp;
fp = fopen("file.txt", "w");
fprintf(fp, "Hello");
fclose(fp);

You might also like