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 145easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4};
int p[4];
p = ary;
printf("%d\n", p[1]);
}Question 146easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int *((*x)())[2];
x();
printf("after x\n");
}
int *((*x)())[2]
{
int **str;
str = (int*)malloc(sizeof(int)* 2);
return str;
}Question 147easy
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);
}Advertisement
Question 148easy
What will be the output of the following C code?
#include <stdio.h>
int *f();
int main()
{
int *p = f();
printf("%d\n", *p);
}
int *f()
{
int j = 10;
return &j
}Question 149easy
What will be the output of the following C code?
#include <stdio.h>
struct student
{
int no;
char name[20];
};
void main()
{
student s;
s.name = "hello";
printf("hello");
}Question 150easy
Which of the following are generated from char pointer?
Advertisement
Question 151easy
What will be the output of the following C code?
#include <stdio.h>
void f(char *k)
{
k++;
k[2] = 'm';
printf("%c\n", *k);
}
void main()
{
char s[] = "hello";
f(s);
}Question 152easy
What will be the output of the following C code?
#include <stdio.h>
void f(int);
void (*foo)(float) = f;
int main()
{
foo(10);
}
void f(int i)
{
printf("%d\n", i);
}Question 153easy
Which of the following is the correct syntax to declare a 3 dimensional array using pointers?