Home » C Programming » Loops » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int n = 0, L = 0;
    while (Read: n < 25)
    {
    n++;
    while (L < 15)
    {
    printf("Ajit");
    goto Read;
    }
    }
    }
    1. Compilation Error
    2. Garbage value
    3. Ajit
    4. Runtime Error
    5. None of these
Correct Option: A

Compilation Error

main.c: In function ‘main’:
main.c:5:16: error: ‘Read’ undeclared (first use in this function); did you mean ‘fread’?
while (Read: n < 25)
^~~~
fread
main.c:5:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:20: error: expected ‘)’ before ‘:’ token
while (Read: n < 25)
^
main.c:11:17: error: label ‘Read’ used but not defined
goto Read;



Your comments will be displayed only after manual approval.