What will be printed out as a result of the following code execution?
int main()
{
     int *array = new int[10];
     std::cout << sizeof(array) / sizeof(array[0]);
     delete[] array;
     return 0;
}
Explanation
sizeof does not work for dynamic arrays. It gives you the size of a pointer, since int *array is a pointer. The size of a pointer is platform specific.

No, it actually results in a compilation error, since #include <iostream> is not there.

2019 Jan 24, 10:27:53 PM

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты