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

    std::cout << sizeof(a);
    std::cout << sizeof(++ptr);
    std::cout << *ptr;
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
Обратная Связь
Зарегистрируйся сейчас
или Подпишись на будущие тесты