Essential C Programming Syntax and Memory Management
Operators
- Arithmetic: +, -, *, /, %
- Relation: ==, !=, >, <, >=, <=
- Logic: &&, ||, !
- Assignment: =, +=, -=, *=, /=, ?=
- Increment: ++, --
- Order of operations: (), *, /, %, +, -, <>, ==, !=
ASCII Conversions
- Lowercase to uppercase: 'x' - 32
- Uppercase to lowercase: 'x' + 32
Data Types
| Data Types | Example | Size | Format |
|---|---|---|---|
| int | int age = 19; | 4 bytes | %d |
| float | float a = 3.7; | 4 bytes | %f |
| double | double pi = 3.1415; | 8 bytes | %lf |
| char | char grader = 'a'; | 1 byte | %c |
| string | char name[20] = "pierre"; | array | %s |
Constants
#define TAX 0.13 const int Max = 100;
Control Structures
Statements: if, else if, else
Switches
switch(x) {
case 1: printf("One"); break;
case 2: printf("Two"); break;
default: printf("Other");
}Loops: while, do while, for
For Loop Example
#include <stdio.... Continue reading "Essential C Programming Syntax and Memory Management" »
English with a size of 62.93 KB