What is the output of the code written in C? void main()
What is the output of the code written in C?
void main()
{
int k, v;
k = (v=20, v+2);
printf("%d/n", k);
}
Show answerHide answer
Correct answer: (C) 22
Explanation
The comma operator evaluates v = 20, then v + 2, and returns the last value, so k = 22. (The "/n" is printed literally after it.)