-
What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input).
#include <stdio.h>
void main()
{
char *n;
printf("Enter a value between 1 to 3:");
scanf("%s", n);
switch (n)
{
case "1":
printf("Hey");
break;
case "2":
printf("Hello");
break;
}
}
-
- Hey
- Hellow
- Compilation Error
- Runtime Error
- None of these
Correct Option: C
Compilation Error
error: '::main' must return 'int'
void main()
In function 'int main()':
error: switch quantity not an integer
switch (ch)