Pointers in C Programming MCQ (Multiple Choice Questions And Answers)
Are you preparing for the next job interviews? If yes, trust me this post will help you also we'll suggest you check out a big collection for Programming Full Forms that may help you in your interview:
List of Programming Full Forms
#include <stdio.h>
int main()
{
int i = 0, j = 1;
int *a[] = {&i, &j};
printf("%d", (*a)[0]);
return 0;
}
- 0
- 4
- Compilation Error
- Run time error
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int *r = &p;
printf("%d", (**r));
}
- 3
- 1
- 2
- Compile time error
int main()
{
int a = 1, b = 2, c = 3;
int *ptr1 = &a, *ptr2 = &b, *ptr3 = &c;
int **sptr = &ptr1; //-Ref
*sptr = ptr2;
}
- ptr1 points to a
- Both A and B
- ptr1 points to b
- None of the above
- a is structure and b is a pointer to a structure
- a and b are structures
- a is a pointer to a structure and b is a structure
- All of the above
- int *a[] = {{1, 2, 3}, {2, 3, 4, 5}};
- int a[][] = {{1, 2, 3}, {2, 3, 4, 5}};
- Both A and B
- None of the above