32-bit system. What will print the program:
int main()
{
    char a[] = "Hello";
    char *ptr = a;

    std::cout << sizeof(a);
    ptr++;
    std::cout << sizeof(++ptr);
    std::cout << *ptr;
}
Explanation
a - is an array whose memory size is equal to 6 bytes. 5 bytes for the Hello + 1 byte at the end of a null string.
Expressions inside the sizeof operator are not evaluated (C ++ Standard § 5.3.3 Sizeof), so ptr points to the symbol e.
The size of the pointer on 32bit systems is 4 bytes

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести