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
3/13
Page
Pick an option on a question to see the right answer and solution.
int (*p) [5];
means
Select an option to see the answer and solution.
const int *ptr;
Select an option to see the answer and solution.
#include<stdio.h>
void main()
{
int *ptr, a=10;
ptr = &a;
*ptr += 1;
printf("%d, %d", *ptr, a);
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
main()
{
char *p;
printf("%d %d",sizeof(*p), sizeof(p));
}Select an option to see the answer and solution.
#include <stdio.h>
void main()
{
int i=3, *j, **k;
j = &i;
k = &j;
printf("%d%d%d", *j, **k, *(*k));
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
void main()
{
char *msg = "hi";
printf(msg);
}Select an option to see the answer and solution.
void main()
{
int array[10];
int *i = &array[2], *j = &array[5];
int diff = j-i;
printf("%d", diff);
}Select an option to see the answer and solution.
void main()
{
printf("%d, %d", sizeof(int *), sizeof(int **));
}Select an option to see the answer and solution.
void main()
{
int i=10; /* assume address of i is 0x1234ABCD */
int *ip=&i;
int **ipp=&&i;
printf("%x,%x,%x", &i, ip, *ipp);
}Select an option to see the answer and solution.
void main()
{
int a[10], i, *p;
a[0] = 1;
a[1] = 2;
p = a;
(*p)++;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include<stdio.h>
void main()
{
int a[]={ 1, 2, 3, 4, 5 }, *p;
p=a;
++*p;
printf("%d ", *p);
p += 2;
printf("%d", *p);
}Select an option to see the answer and solution.
char* myfunc(char *ptr)
{
ptr+=3;
return(ptr);
}
void main()
{
char *x, *y;
x = "EXAMVEDA";
y = myfunc(x);
printf("y=%s", y);
}What will be printed when the sample code above is executed?
Select an option to see the answer and solution.
char *ptr;
char myString[] = "abcdefg";
ptr = myString;
ptr += 5;what string does ptr point to in the sample code above?
Select an option to see the answer and solution.
#include <stdio.h>
int main()
{
int i = 10;
int *p = &i;
foo(&p);
printf("%d ", *p);
printf("%d ", *p);
}
void foo(int **const p)
{
int j = 11;
*p = &j;
printf("%d ", **p);
}Select an option to see the answer and solution.
#include <stdio.h>
void main()
{
char *s= "hello";
char *p = s;
printf("%c\t%c", *(p + 3), s[1]);
}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("%p %p", *r, a);
}Select an option to see the answer and solution.