818 views
2 votes
2 votes
int main()
{
    int *r2;
    void abc(int **);
    abc(&r2);
    printf("%d",*r2);
}
void abc(int **r3)
{
    int r1=5;
    /* add statements here */
}

Which statement is added to the above program such that the address of r1 gets stored in r2?

A) *r2 = &r1;

B)*r1 = &r3;

C) *r3 = &r1;

D) None of these

1 Answer

Best answer
5 votes
5 votes
int main()
{
    int *r2;
    void abc(int **);
    abc(&r2);
    printf("%d",*r2);
}
void abc(int **r3)
{
    Static int r1=5;
    *r3 = &r1;
}

Program should be like this, if address of r1 gets stored in r2 .

selected by

Related questions

0 votes
0 votes
3 answers
1
Sankaranarayanan P.N asked Oct 27, 2016
551 views
What is the output of this C code?#include<stdio.h int main() { do printf("Inside while loop"); while(0); printf("After while loop"); }A) Infinite loopB) Compilation erro...
3 votes
3 votes
2 answers
2
Sankaranarayanan P.N asked Oct 27, 2016
393 views
What will be the output of the following C program fragment?int n =1; switch(n) { case 1: printf("One"); case 2: printf("Two"); case 3: case 4: case 5: default: printf("W...
2 votes
2 votes
1 answer
3
Sankaranarayanan P.N asked Oct 27, 2016
315 views
int add(int a) { static int count = 0; count = count + a; return(count); } main() { int a, b; for(a=0; a<=4; a++) b=add(a); }What is the value of b at the end of executio...
1 votes
1 votes
1 answer
4
Sankaranarayanan P.N asked Sep 28, 2016
1,158 views
What will be the value of f after the execution of following programvoid main() { char a; float f = 10; for(a=1; a<=5; a++) { f-=.2; printf("\nf = %g", f); } }A) 5.0B) 9C...