Select an option to see the answer and solution.
Pointer
practice.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
253
Questions
5/13
Page
Pick an option on a question to see the right answer and solution.
#include <stdio.h>
int main()
{
int i = 0, j = 1;
int *a[] = {&i, &j};
printf("%d", (*a)[1]);
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <stdio.h>
int main()
{
int a = 10;
int **c -= &&a;
}Select an option to see the answer and solution.
#include <stdio.h>
int main()
{
int ary[2][3];
ary[][] = {{1, 2, 3}, {4, 5, 6}};
printf("%d\n", ary[1][0]);
}Select an option to see the answer and solution.
char *str[5];Select an option to see the answer and solution.
#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]);
}Select an option to see the answer and solution.
#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int *r = &p;
printf("%d", (**r));
}Select an option to see the answer and solution.
#include <stdio.h>
struct student
{
int no;
char name[20];
};
void main()
{
struct student s;
s.no = 8;
printf("hello");
}Select an option to see the answer and solution.
#include <stdio.h>
void main()
{
char a[10][5] = {"hi", "hello", "fellows"};
printf("%s", a[2]);
}Select an option to see the answer and solution.
#include <stdio.h>
int main()
{
char *a[2] = {"hello", "hi"};
printf("%d", sizeof(a));
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <stdio.h>
int main()
{
char *p[1] = {"hello"};
printf("%s", (p)[0]);
return 0;
}Select an option to see the answer and solution.
#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int *r = &p;
printf("%d", (**r));
}Select an option to see the answer and solution.
#include <stdio.h>
int main()
{
char *str = "hello world";
char strary[] = "hello world";
printf("%d %d\n", sizeof(str), sizeof(strary));
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <stdio.h>
int main()
{
int a[4] = {1, 2, 3, 4};
int b[4] = {1, 2, 3, 4};
int n = &b[3] - &a[2];
printf("%d\n", n);
}Select an option to see the answer and solution.
#include <stdio.h>
void f(int a[][3])
{
a[0][1] = 3;
int i = 0, j = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
printf("%d", a[i][j]);
}
void main()
{
int a[2][3] = {0};
f(a);
}Select an option to see the answer and solution.
Q100
Open question#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);
}Select an option to see the answer and solution.