Top

Pointers

1.

What is the output of this C code?

void main()
{
int k = 5;
int *p = &k;
int **m = &p;
printf("%d%d%d\n", k, *p, **m);
}

 

Answer: A

No answer description available for this question.
 

Enter details here

2.

What would be the equivalent pointer expression for referring the array element a[i][j][k][l]

Answer: B

No answer description available for this question.

Enter details here

3.

What will be the output of the program If the integer is 4bytes long?

#include

int main()
{
    int ***r, **q, *p, i=8;
    p = &i;
    q = &p;
    r = &q;
    printf("%d, %d, %d\n", *p, **q, ***r);
    return 0;
}

 

Answer: A

No answer description available for this question.

Enter details here

4.

What is the output of this C code?

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);
}

 

Answer: B

No answer description available for this question.
 

Enter details here

Answer: C

No answer description available for this question.
 

Enter details here

6.

What is the output of this C code?

void main()
{
int x = 0;
int *ptr = &5;
printf("%p\n", ptr);
}

 

Answer: D

No answer description available for this question.
 

Enter details here

7.

What will be the output of the following C code?

#include 
    void foo(int*);
    int main()
    {
        int i = 10, *p = &i;
        foo(p++);
    }
    void foo(int *p)
    {
        printf("%d\n", *p);
    }

 

Answer: A

No answer description available for this question.

Enter details here

Answer: A

No answer description available for this question.
 

Enter details here

9.

Are the expression *ptr++ and ++*ptr are same?

Answer: B

No answer description available for this question.
 

Enter details here

10.

In the following program add a statement in the function fun() such that address of a gets stored in j?

#include
int main()
{
    int *j;
    void fun(int**);
    fun(&j);
    return 0;
}
void fun(int **k)
{
    int a=10;
    /* Add a statement here */
}

 

Answer: C

No answer description available for this question.
 

Enter details here

Loading…
Tags: Pointers Questions and Answers || Pointers MCQ Questions and Answers || Pointers GK Questions and Answers || Pointers GK MCQ Questions || Pointers Multiple Choice Questions and Answers || Pointers GK || GK on Pointers || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming