A variable n of data type int is assigned a value 10 and accessed via a pointer ipt. After an increment of 2 on the value of ipt , what will become the value of n?
write out the code for this task
1
Expert's answer
2011-06-09T06:34:50-0400
May be you missed something in your question so we'd analyzed all cases:
void operation1(int * ipt) //2+ipt { int a=2; a+=ipt; //types do not match. a-int ipt-int*. error while compilation }
void operation2(int * ipt) //2+(*ipt) - as for me this one match to your question { & int a=2; a+=*ipt; //a=12, n does not change }
void operation3(int * ipt) //(*ipt)+2 { int a=2; *ipt+=a; //n=12, a does not change (a=2) }
void main() { int n=10; operation1(&n); operation2(&n); operation3(&n); }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment