Pointer MCQs

253 questionsC-ProgramPage 10 of 29

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 82easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int i = 0, j = 1;
    int *a[] = {&i, &j};
    printf("%d", (*a)[1]);
    return 0;
}
Question 83easy
Which of the following is the correct syntax to send an array as a parameter to function?
Question 84easy
Which is true for b, if b is defined as "int *b[10];"?
Advertisement
Question 85easy
Comment on the output of the following C code.
#include <stdio.h>
int main()
{
    int a = 10;
    int **c -= &&a
}
Question 86easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int ary[2][3];
    ary[][] = {{1, 2, 3}, {4, 5, 6}};
    printf("%d\n", ary[1][0]);
}
Question 87easy
What makes the following declaration denote?
char *str[5];
Advertisement
Question 88easy
What will be the output of the following C code?
#include <stdio.h>
void foo(int *ary[]);
int main()
{
    int ary[2][3];
    foo(ary);
}
void foo(int *ary[])
{
    int i = 10, j = 2, k;
    ary[0] = &i
    ary[1] = &j
    *ary[0] = 2;
    for (k = 0;k < 2; k++)
    printf("%d\n", *ary[k]);
}
Question 89easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int a[3] = {1, 2, 3};
    int *p = a;
    int *r = &p
    printf("%d", (**r));
}
Question 90easy
What will be the output of the following C code?
#include <stdio.h>
struct student
{
    int no;
    char name[20];
};
void main()
{
    struct student s;
    s.no = 8;
    printf("hello");
}