#include <iostream>using namespace std;int main(){ int x = 0, y = 4; int thisIsAlsoAnIntVariable = 10; y = y * 8; cout << "The number stored in x is " << x << ".\n"; cout << "On a 32 bit system, an int is " << y << " bits.\n"; cout << "An int can be any name you want (following some rules of course).\n" << "Such as thisIsAlsoAnIntVariable = " << thisIsAlsoAnIntVariable << endl; return 0;}
Without using a function, you can see that an int is just a place to store a number. You can use it for math (y = y * 8), and ask the computer to show you what it is. The name is your choice, but usually long names are not used because they are slow to type and remember, easier to screw up typing, and make the code look messier.
Note: the 'int' before main just tells what type of value my function will return. This corresponds with 'return 0', which is saying the int that it is returning is now 0.