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

Answers were Sorted based on User's Feedback



main() { int i=1; while (i<=5) { printf("%d",i); if (i&..

Answer / surenda pal singh chouhan

Compiler error: Undefined label 'here' in function main

Explanation:
Labels have functions scope, in other words The scope of
the labels is limited to functions . The label 'here' is
available in function fun() Hence it is not visible in
function main.

Is This Answer Correct ?    16 Yes 0 No

main() { int i=1; while (i<=5) { printf("%d",i); if (i&..

Answer / jaroosh

Exactly, to be able to move control flow to here, you would
have to make a long jump using not very common functions
(that do actually more than goto) : setjmp and longjmp
(please look up those functions in google or some C standard
library reference).

Is This Answer Correct ?    5 Yes 1 No

main() { int i=1; while (i<=5) { printf("%d",i); if (i&..

Answer / dinakaran gct

The program is error because of the "goto" statement can't
jump from one segment to another segment i.e not support for
long jump.

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More C Interview Questions

Define and explain about ! Operator?

0 Answers  


Explain the term printf() and scanf() used in c language?

0 Answers  


How to write c functions that modify head pointer of a linked list?

0 Answers  


Why is it that not all header files are declared in every C program?

0 Answers  


what is the difference between c and java?

1 Answers  






write a C program to print the program itself ?!

16 Answers   TCS,


What is the purpose of sprintf() function?

0 Answers  


what does exit() do?

3 Answers   Cadence,


how do you execute a c program in unix.

0 Answers  


Difference between C and Embedded C?

1 Answers  


program for following output using for loop? 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5

8 Answers   Aptech, Infosys,


Does free set pointer to null?

0 Answers  


Categories