• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

C Quiz - 105 | Question 3

What would happen when we compile and run this program?
C
<br>
#include < stdio.h ><br>
int main()<br>
{<br>
  int i; <br>
  goto LOOP;<br>
  for (i = 0 ; i < 10 ; i++)<br>
  {<br>
     printf(\"GeeksQuiz &#92;n\");<br>
     LOOP:<br>
      break;<br>
  }<br>
  return 0;<br>
}<br>

(A)

No compile error and it will print GeeksQuiz 10 times because goto label LOOP wouldn’t come in effect.

(B)

No compile error and it’ll print GeeksQuiz only once because goto label LOOP would come in picture only after entering for loop.

(C)

Compile Error because any goto label isn’t allowed in for loop in C.

(D)

No compile error but behaviour of the program would depend on C compiler due to nondeterministic behaviour of goto statement.

(E)

No compile error and it will not print anything.

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments