g++ hello_world.cpp && ./a.out
g++ -std=c++11 code.cpp && ./a.out
Note
This syntax will work on mac system only.
- int - 4 Bytes
- char - 1 Bytes
- float - 4 Bytes
- double - 8 Bytes
- bool - 1 Bytes
Converting data from one type to another
-
Conversion [implicit]
- Small to big
float (4 bytes) to double (8 bytes)
- Small to big
-
Casting [explicit]
-
Big to Small
double to int
double price = 100.99; int newPrice = (int)price; cout << newPrice << endl;
output: 100
-