Multiple choice

What will be the output of the following question?

fun() {
here: printf(“pp”); } main() { int i=1; while(i<=5) { printf(“%d”,i); if(i>2) goto here; i++; } }

  1. 1 2 3 pp 4 pp 5 pp

  2. 1 2 3 4 5

  3. 1 2 pp pp pp

  4. Error

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The goto statement in C is restricted to jumping within the same function. Because the label 'here' is defined in fun() and the goto statement is in main(), the code will fail to compile.