Pointer MCQs
Practice free Pointer multiple-choice questions with instant answer feedback and step-by-step solutions. Click an option to check yourself, reveal the full explanation, and work through all 253 questions — no login required.
Question 190easy
What will be the output of the following C code?
#include <stdio.h>
int sub(int a, int b, int c)
{
return a - b - c;
}
void main()
{
int (*function_pointer)(int, int, int);
function_pointer = ⊂
printf("The difference of three numbers is:%d",
(*function_pointer)(2, 3, 4));
}Question 191easy
Which of the following declaration will result in run-time error?
Question 192easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
char *a[2] = {"hello", "hi"};
printf("%s", *(a + 1));
return 0;
}Advertisement
Question 193easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int k = 5;
int *p = &k
int **m = &p
**m = 6;
printf("%d\n", k);
}Question 194easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
char *p = NULL;
char *q = 0;
if (p)
printf(" p ");
else
printf("nullp");
if (q)
printf("q\n");
else
printf(" nullq\n");
}Question 195easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 97, *p = &i
foo(&i);
printf("%d ", *p);
}
void foo(int *p)
{
int j = 2;
p = &j
printf("%d ", *p);
}Advertisement
Question 196easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int ary[2][3][4], j = 20;
ary[0][0] = &j
printf("%d\n", *ary[0][0]);
}Question 197easy
What will be the output of the following C code?
#include <stdio.h>
void m(int *p, int *q)
{
int temp = *p; *p = *q; *q = temp;
}
void main()
{
int a = 6, b = 5;
m(&a, &b);
printf("%d %d\n", a, b);
}Question 198easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 97, *p = &i
foo(&p);
printf("%d ", *p);
return 0;
}
void foo(int **p)
{
int j = 2;
*p = &j
printf("%d ", **p);
}