C
Programming and Technical
Programming
Program
What will be the output of the program?
#include
int main()
{
static int a[20];
int i = 0;
a[i] = i ;
printf("%d, %d, %dn", a[0], a[1], i);
return 0;
}
Options
1) 1, 0, 1
2) 1, 1, 1
3) 0, 0, 0
4) 0, 1, 0
Read Solution (Total 2)
-
- Ans: 3 but more corectly ans is 0,0,0n
- 7 years agoHelpfull: Yes(1) No(0)
- option -3
0,0,0
because the array a[] is declared as static which initialized the array as zero and the value of i is also zero - 7 years agoHelpfull: Yes(0) No(0)
C Other Question
What will be the output of the program ?
#include
int main()
{
static char *s[] = {"black", "white", "pink", "violet"};
char **ptr[] = {s+3, s+2, s+1, s}, ***p;
p = ptr;
++p;
printf("%s", **p+1);
return 0;
}
Options
1) ink
2) ack
3) ite
4) let
What will be the output of the program?
#include
int main()
{
int x=12, y=7, z;
z = x!=4 || y == 2;
printf("z=%dn", z);
return 0;
}
Options
1) z=0
2) z=1
3) z=4
4) z=2