Skip to content

B) Basic

kalinosia edited this page Mar 13, 2021 · 2 revisions

C++ uses a number of keywords to identify operations and data descriptions; therefore, identifiers created by a programmer cannot match these keywords. The standard reserved keywords that cannot be used for programmer created identifiers are:

alignas, alignof, and, and_eq, asm, auto, bitand, bitor, bool, break, case, catch, char, char16_t, char32_t, class, compl, const, constexpr, const_cast, continue, decltype, default, delete, do, double, dynamic_cast, else, enum, explicit, export, extern, false, float, for, friend, goto, if, inline, int, long, mutable, namespace, new, noexcept, not, not_eq, nullptr, operator, or, or_eq, private, protected, public, register, reinterpret_cast, return, short, signed, sizeof, static, static_assert, static_cast, struct, switch, template, this, thread_local, throw, true, try, typedef, typeid, typename, union, unsigned, using, virtual, void, volatile, wchar_t, while, xor, xor_eq

BOOL

bool isReal = true; bool isThere = false;

INT

int number = 6; int max = 2147483647 (-/+)

CHAR

`char letter='A';

ASCII TABLE in ''

STRING

char c = 'a';
string some(3, c);
cout<<some<<endl; //aaa
c++; //c='b'

Table string vs char

string table_str[] = {"mama", "ma", "kota"};
char table_char[] = {'h', 'e', 'l', 'l', 'o'};
cout<<table_str<<endl; //---> 0x7256d9a58110 - address of first element
cout<<table_char<<endl; // ---> hello -->!!!

//ALSO
char table_char_second[]="hello";
cout<<table_char_second<<endl; //---> hello
cout << sizeof(table_char_second)<<endl; //---> 6 !!! why? 5 letters + \0

MORE IN POINTERS!

Clone this wiki locally