General Knowledge :: Testing New
-
Determine Output:
void main()
{
int i;
printf("%d", scanf("%d", &i)); // value 10 is given as input here
}
-
Determine Output:
void main()
{
int i=0;
for(;i++;printf("%d", i));
printf("%d", i);
}
-
Determine Output:
void main()
{
struct xx
{
int x=3;
char name[] = "hello";
};
struct xx *s = malloc(sizeof(struct xx));
printf("%d", s->x);
printf("%s", s->name);
}
-
Determine output:
void main()
{
extern int i;
i=20;
printf("%d", sizeof(i));
}
-
Determine Output:
void main()
{
int i=0, j=0;
if(i && j++)
printf("%d..%d", i++, j);
printf("%d..%d", i, j);
}
-
Determine Output:
void main()
{
static int i=5;
if(--i){
main();
printf("%d ", i);
}
}
-
Determine Output:
void 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);
}
-
Determine Output:
void main()
{
int i = -1;
+i;
printf("i = %d, +i = %d", i, +i);
}
-
Determine Output:
void main()
{
char *str1 = "abcd";
char str2[] = "abcd";
printf("%d %d %d", sizeof(str1), sizeof(str2), sizeof("abcd"));
}
-
Determine Output:
void main()
{
char not;
not = !2;
printf("%d", not);
}