What will be the output of the following C code?
#include < stdio.h >
int main()
{
int x = 97;
switch (x)
{
case ‘a’:
printf(“yes “);
break;
case 97:
printf(“no\n”);
break;
}
}
a) yes
b) yes no
c) Duplicate case value error
d) Character case value error
Answer: c
Related Posts
What will be the output of the following C code?
#include < stdio.h >
void foo();
int main()
{
void foo(int);
foo();
return 0;
}
void foo()
{
printf(“2 “);
}What will be the output of the following C code?
#include < stdio.h >
void foo();
int main()
{
void foo(int);
foo(1);
return 0;
}
void foo(int i)
{
printf(“2 “);
}What will be the output of the following C code?
#include < stdio.h >
void foo();
int main()
{
void foo();
foo();
return 0;
}
void foo()
{
printf(“2 “);
}What will be the output of the following C code?
#include < stdio.h >
int main()
{
void foo();
void f()
{
foo();
}
f();
}
void foo()
{
printf(“2 “);
}What will be the output of the following C code?
#include < stdio.h >
int main()
{
void foo(), f();
f();
}
void foo()
{
printf(“2 “);
}
void f()
{
printf(“1 “);
foo();
}What will be the output of the following C code?
#include < stdio.h >
int main()
{
void foo();
printf(“1 “);
foo();
}
void foo()
{
printf(“2 “);
}What will be the output of the following C code?
#include < stdio.h >
void main()
{
int i = 0, k;
label: printf(“%d”, i);
if (i == 0)
goto label;
}
Join The Discussion