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

C Programming Crash Sheet

This document is a crash sheet for C programming, covering essential topics such as program structure, data types, input/output, operators, control structures, functions, arrays, pointers, structures, and file handling. It also includes quick tips for effective programming in C. Key concepts are illustrated with code examples to aid understanding.

Uploaded by

jyashnimde
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)
20 views2 pages

C Programming Crash Sheet

This document is a crash sheet for C programming, covering essential topics such as program structure, data types, input/output, operators, control structures, functions, arrays, pointers, structures, and file handling. It also includes quick tips for effective programming in C. Key concepts are illustrated with code examples to aid understanding.

Uploaded by

jyashnimde
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

■ 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.

You might also like