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
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 |
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 |
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 |
Write a program to print the following series 2 5 11 17 23 31 41 47 59 ...
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
Write a code to generate divisors of an integer?
What is the purpose of void pointer?
atoi, which takes a string and converts it to an integer. write a program that reads lines(using getline), converts each line to an integer using atoi and computes the average of all the numbers read. also compute the standard deviation
How do you declare a variable that will hold string values?
write a proram to reverse the string using switch case?
What is an volatile variable?
What are the uses of pre-processor directives?
What is merge sort in c?
What is void pointers in c?
What is getch?