Test Your C Skills Class: Roll No: 1. What Will Be Output of Following C Code?
Test Your C Skills Class: Roll No: 1. What Will Be Output of Following C Code?
Output:
10 5
Output:
6
main()
{
int i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}
Output:
00131
1
4. What will be output of following c code?
main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
}
Output:
12
Output:
111
222
333
344
#include<stdio.h>
2
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}
Output:
77
#include<stdio.h>
main()
{
int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };
int *p,*q;
p=&a[2][2][2];
*q=***a;
printf("%d----%d",*p,*q);
}
Output:
SomeGarbageValue---1
main()
{
static char names[5][20]={"pascal","ada","cobol","fortran","perl"};
int i;
char *t;
3
t=names[3];
names[3]=names[4];
names[4]=t;
for (i=0;i<=4;i++)
printf("%s",names[i]);
}
Output:
#include<stdio.h>
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}
Output:
Output:
4
100, 100, 100, 2
114, 104, 102, 3