0
Please explain the output
4 Answers
+ 3
fun(&I, &I) passing I refference so changes in function in i variable location reflect back in original value..
In function:
*i stores *i;
*j stores *i both stores same value i.e 2
*i = *i * *i now *i =4. Original actual argument value in main function also changes, and j also changes since j contains *i location and now *j also 4.
Hence *j = *j * *j =4*4 =16.
Now *i, *j both 16. And actual argument of main i also 16. Notice that j in main, not passed its values and not modified anywhere. So I, j in main prints 16,3
Point to be remembered &I address passing and in function works like *i (farmal) = &i (actual value).. For not to confuse, use different variable names...
Hope it helps.......
https://www.sololearn.com/Discuss/2416942/?ref=app
+ 10
This is his post link.
https://www.sololearn.com/post/480022/?ref=app
+ 1
Thank you