While executing goto statement' what do you feel? Does it require extra time for carrying a jump either forward or
backward by the compiler while executing the code?
Answers
Answered by
1
Answer:
#include <stdio.h>
int main()
{
int sum=0;
for(int i = 0; i<=10; i++){
sum = sum+i;
if(i==5){
goto addition;
}
}
addition:
printf("%d", sum);
return 0;
}
Output:
15
Explanation: In this example, we have a label addition and when the value of i (inside loop) is equal to 5 then we are jumping to this label using goto. This is reason the sum is displaying the sum of numbers till 5 even though the loop is set to run from 0 to 10.
Explanation:
Answered by
1
Answer:
Thanks for Free points
Similar questions
Political Science,
2 months ago
Math,
2 months ago
English,
2 months ago
History,
6 months ago
Social Sciences,
6 months ago
Physics,
11 months ago
English,
11 months ago