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

C Programming Cheat Sheet

This cheat sheet covers essential C programming concepts including compilers, interpreters, and operating systems. It outlines basic data types, operators, control structures, arrays, functions, pointers, file I/O, and structures/unions. Additionally, it highlights common errors such as syntax and logical errors.

Uploaded by

ayan.ali2711
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)
191 views2 pages

C Programming Cheat Sheet

This cheat sheet covers essential C programming concepts including compilers, interpreters, and operating systems. It outlines basic data types, operators, control structures, arrays, functions, pointers, file I/O, and structures/unions. Additionally, it highlights common errors such as syntax and logical errors.

Uploaded by

ayan.ali2711
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 Exam Cheat Sheet

Basic Concepts:

- Compiler: Converts code into machine language (e.g., GCC).

- Interpreter: Executes code line by line (e.g., Python).

- OS: Manages hardware/software, handles I/O, memory.

- Syntax vs Semantics: Syntax = rules, Semantics = meaning.

Number Systems:

- Decimal to Binary: divide by 2 repeatedly.

- Decimal to Hex: divide by 16 repeatedly.

- Example: 45 -> Binary: 101101, Hex: 2D

C Language Basics:

- Data Types: int, float, char, double.

- Operators: +, -, *, /, %, ==, !=, &&, ||, !

- Control: if, if-else, switch, for, while, do-while.

Arrays & Functions:

- Array: int arr[5] = {1,2,3,4,5};

- Function: return_type name(params) { ... }

- Recursion: A function calling itself.

Pointers:

- Pointer stores address: int *p = &x;

- Dereference: *p gives value at address.

File I/O:

- FILE *fp = fopen("file.txt", "r");

- fprintf(fp, ...), fscanf(fp, ...)

- fclose(fp); Modes: r, w, a

Structures & Unions:

- Structure: group of different data types.

- Union: shares memory among members.

- struct student { int id; char name[20]; };

Common Errors:

- Syntax Error: code rule mistake (e.g., missing ;)


- Logical Error: output is wrong despite no error.

You might also like