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;
}
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.
Login in to like
Login in to comment