Which of the following correctly describe the output of the ANSI C function below, if passed a value of "5"?
Which of the following correctly describe the output of the ANSI C function below, if passed a value of "5"?
#include<stdio.h
void process(int i)
{
printf("begin\n");
switch (i)
{
case 5:
printf("slow\n");
case 6:
default:
printf("halt\n");
case 1:
case 2:
printf("waiting\n");
break;
case 3:
printf("forward\n");
goto cleanup;
case 4:
printf("reverse\n");
break;
}
printf("end\n");
return;
cleanup:
/* ... */
}
A) begin
slow
halt
B) begin
slow
end
C) begin
end
D) begin
slow
halt
waiting
E) begin
slow
halt
waiting
end
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images