• The function that runs when we execute the program • “0” return means successful execution • Should return “int”, but compilers accept “void” returns too
b = false; char c = ‘A’; double d = 10.4; float f = 11.5; Primitive data types are integer, boolean, character, float and double. These can be modified with long, unsigned, and short modifiers.
‘c’}; a[2] = 5; • An array is a sequence, of finite size, of a particular data size. • int a[3] means “a” is an ordered set of 3 integers. • These can be accessed as a[0], a[1], a[2].
<< “string”; int a = 10; char c = ‘C’; cout << a << c << endl; cout << “new \n line”; • “cout” which means console output, can be used to print to console. • The “<<” operator shifts data into the cout. • We can print data directly, or data variables.
cin >> c; char str[10]; cin >> str; • Like “cout”, “cin” means console input. • We use the “>>” operator to shift data from the cin into our variable. • We can use cin for any primitive data type, as well as string.
the data is stored. • We use the “ * ” (dereference operator) and “ & ” (address operator) to work with pointers • pointers are also a kind of data type. • address of variable is a pointer • dereference of a pointer gives data stored there