Lesson 2 of 8Article15 minFREE
Variables, Data Types, and Operators
Variables, Data Types, and Operators
Primitive data types
- int for whole numbers.
- float and double for decimal values.
- char for single characters.
- Use sizeof(type) to inspect memory footprint.
Operators in C
Arithmetic and comparison
#include <stdio.h>
int main(void) {
int a = 10, b = 3;
printf("Sum: %d\n", a + b);
printf("Remainder: %d\n", a % b);
printf("a > b: %d\n", a > b);
return 0;
}