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 100easy
What will be the output of the following C code?
#include <stdio.h>
void (*(f)())(int, float);
typedef void (*(*x)())(int, float);
void foo(int i, float f);
int main()
{
x = f;
x();
}
void (*(f)())(int, float)
{
return foo;
}
void foo(int i, float f)
{
printf("%d %f\n", i, f);
}Question 101easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
char *str = "hello, world\n";
str[5] = '.';
printf("%s\n", str);
return 0;
}Question 102easy
Is the below declaration legal?
int* ((*x)())[2];Advertisement
Question 103easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int a[2][3] = {1, 2, 3, , 4, 5};
int i = 0, j = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
printf("%d", a[i][j]);
}Question 104easy
What will be the output of the following C code (run without any command line arguments)?
#include <stdio.h>
int main(int argc, char *argv[])
{
while (*argv++ != NULL)
printf("%s\n", *argv);
return 0;
}Question 105easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
char s[] = "hello";
s++;
printf("%c\n", *s);
}Advertisement
Question 106easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 11;
int *p = &i
foo(&p);
printf("%d ", *p);
}
void foo(int *const *p)
{
int j = 10;
*p = &j
printf("%d ", **p);
}Question 107easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int k = 5;
int *p = &k
int **m = &p
printf("%d%d%d\n", k, *p, **p);
}Question 108easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int x = 0;
int *ptr = &5;
printf("%p\n", ptr);
}