■ C Programming Crash Sheet – Mumbai University (FE)
1. Structure of a C Program
#include int main() { printf("Hello, World!"); return 0; }
2. Data Types & Variables
int age = 20; float marks = 88.5; char grade = 'A';
3. Input & Output
scanf("%d", &age;); printf("Age = %d", age);
4. Operators
Arithmetic: +, -, *, /, % Relational: >, <, >=, <=, ==, != Logical: &&, ||, !
5. Control Structures
if(age >= 18) { printf("Adult"); } else { printf("Minor"); } for(int i=0; i<5; i++) { printf("%d ", i); }
6. Functions
int add(int a, int b) { return a + b; } int main() { int sum = add(5, 3); printf("%d", sum); }
7. Arrays & Strings
int arr[5] = {1,2,3,4,5}; char str[20] = "Hello";
8. Pointers
int x = 10; int *ptr = &x; printf("%d", *ptr); // prints 10
9. Structures
struct Student { int roll; char name[20]; }; struct Student s1 = {1, "Yash"};
10. File Handling
FILE *fp; fp = fopen("data.txt", "w"); fprintf(fp, "Hello File!"); fclose(fp);
■ Quick C Programming Tips
- Always include stdio.h for input/output.
- Use & with variables in scanf (address operator).
- Arrays in C are 0-indexed.
- Strings in C end with a null character '\0'.
- Pointers are powerful for memory management – practice well.
- Use gcc or Turbo C++ for compiling.
- Practice MU previous year SPA lab programs.