91. Which of the following declaration will result in run-time error?
92. 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;
}
#include <stdio.h>
int main()
{
char *a[2] = {"hello", "hi"};
printf("%s", *(a + 1));
return 0;
}
93. 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);
}
#include <stdio.h>
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
**m = 6;
printf("%d\n", k);
}
94. 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");
}
#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");
}
95. 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);
}
#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);
}
96. 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]);
}
#include <stdio.h>
int main()
{
int ary[2][3][4], j = 20;
ary[0][0] = &j;
printf("%d\n", *ary[0][0]);
}
97. 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);
}
#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);
}
98. 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);
}
#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);
}
99. What will be the output of the following C code?
#include <stdio.h>
int main()
{
void *p;
int a[4] = {1, 2, 3, 8};
p = &a[3];
int *ptr = &a[2];
int n = p - ptr;
printf("%d\n", n);
}
#include <stdio.h>
int main()
{
void *p;
int a[4] = {1, 2, 3, 8};
p = &a[3];
int *ptr = &a[2];
int n = p - ptr;
printf("%d\n", n);
}
100. Arguments that take input by user before running a program are called?
Read More Section(Pointer)
Each Section contains maximum 100 MCQs question on Pointer. To get more questions visit other sections.