Comment on the output of this C code?
int main()
{
int a = 10;
int **c -= &&a;
}
Answer: B
No answer description available for this question.
Enter details here
What is the output of this C code?
int *f();
int main()
{
int *p = f();
printf("%d\n", *p);
}
int *f()
{
int *j = (int*)malloc(sizeof(int));
*j = 10;
return j;
}
Answer: A
No answer description available for this question.
Enter details here
What will be the output of the following C code?
#include
int main()
{
int i = 10;
int *const p = &i;
foo(&p);
printf("%d\n", *p);
}
void foo(int **p)
{
int j = 11;
*p = &j;
printf("%d\n", **p);
}
Answer: A
No answer description available for this question.
Enter details here
Can you combine the following two statements into one?
char *p;
p = (char*) malloc(100);
Answer: C
No answer description available for this question.
Enter details here
What will be the output of the program if the size of pointer is 4-bytes?
#include
int main()
{
printf("%d, %d\n", sizeof(NULL), sizeof(""));
return 0;
}
Answer: C
In TurboC, the output will be 2, 1 because the size of the pointer is 2 bytes in 16-bit platform.
But in Linux, the output will be 4, 1 because the size of the pointer is 4 bytes.
This difference is due to the platform dependency of C compiler.
Enter details here
Which of the following statements correctly declare a function that receives a pointer to pointer to a pointer to a float and returns a pointer to a pointer to a pointer to a pointer to a float?
Answer: D
No answer description available for this question.
Enter details here
What is the output of this C code?
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int **r = &p;
printf("%p %p", *r, a);
}
Answer: C
No answer description available for this question.
Enter details here
What is the output of this C code?
int main()
{
int *ptr, a = 10;
ptr = &a;
*ptr += 1;
printf("%d,%d/n", *ptr, a);
}
Answer: D
No answer description available for this question.
Enter details here
What will be the output of the program assuming that the array begins at the location 1002 and size of an integer is 4 bytes?
#include
int main()
{
int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
printf("%u, %u, %u\n", a[0]+1, *(a[0]+1), *(*(a+0)+1));
return 0;
}
Answer: C
No answer description available for this question.
Enter details here
What will be the output of the following C code?
#include
void foo(int*);
int main()
{
int i = 10;
foo((&i)++);
}
void foo(int *p)
{
printf("%d\n", *p);
}
Answer: C
No answer description available for this question.
Enter details here