What will be printed out as a result of the program execution?
#include <iostream>

void func(int a, int b, int c, int d)
{
   std::cout << a << b << c << d;
}

int main()
{
   int a = 0;
   func(++a, a++, ++a, a++);
   return 0;
}
Explanation
The order of calculating the arguments passed into the function is not defined. That's why the result of this code execution is undefined behavior. You may read the details here: Sequence point.

Следи за CodeGalaxy

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

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