0 votes 0 votes #include<stdio.h> void fun(int *p,int *q) { p=q; *p=q; } int i=0,j=1; int main() { fun(&i,&j); printf("%d%d",i,j); } What will be the output of i and j in 16-bit C Compiler? Programming in C programming-in-c output programming pointers + – Mr khan 3 asked Nov 3, 2018 • retagged Mar 11, 2019 by Naveen Kumar 3 Mr khan 3 1.0k views answer comment Share Follow See all 6 Comments See all 6 6 Comments reply Show 3 previous comments Shaik Masthan commented Nov 3, 2018 reply Follow Share @Vikas Verma *p=q; *p means it is integer, q means integer pointer.... so, you can't assign them 0 votes 0 votes Vikas Verma commented Nov 3, 2018 reply Follow Share On execution, I got a warning but not a compilation error for that. 0 votes 0 votes Shaik Masthan commented Nov 3, 2018 reply Follow Share did you run it on offline ? because online compilers does some error recovery... But the concept is you can't assign them, even offline compilers also gives only warning message. After that it is your wish. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes #include<stdio.h> void fun(int *p,int *q) { p=q; /*3. p was pointing to i but now content of p are changed to address of q */ *p=q; /*4. p is pointing to j so now content of j are changed with its own address */ } int i=0,j=1; /*1. global variables i and j defined */ int main() { fun(&i,&j); /*2. function fun is called and addresses of i and j are passed as parameters */ printf("%d%d",i,j); /*5. 0 address-of-j-in-int */ } Output : 0 address-of-j-in-int https://ideone.com/CMYOAh Mk Utkarsh answered Nov 10, 2018 Mk Utkarsh comment Share Follow See all 0 reply Please log in or register to add a comment.