Sign in to follow this  
Followers 0
chitkaraankit

c predict output


void main(){int count=10,*temp,sum=0;temp=&count;*temp=20;temp=∑*temp=count;printf("%d %d %d ",count,*temp,sum);}If possible explain also

Share this post


Link to post
Share on other sites

void main() { int count=10,*temp,sum=0; temp=&count; *temp=20; temp=∑ *temp=count; printf("%d %d %d ",count,*temp,sum); } If possible explain also

void main() { int count=10, sum=0; int *temp; temp=&count;// here u r assigning address of count to temp. *temp=20;//temp is pointing to count now. *temp means value at temp. the value at temp is count. so count is 20 now. temp=∑//overwriting the content of temp with address of sum *temp=count;//count value is 20 as mentioned earlier. now *temp is pointing to sum. so sum will be assigned as 20. printf("%d %d %d ",count,*temp,sum);//all are 20 here. }

Share this post


Link to post
Share on other sites

any one who can answer?

void main() { int count=10, sum=0; int *temp; temp=&count; //Now temp will point the address of count variable. *temp=20; //We are assigning the value to the address which temp is pointing, so the changes will reflect in count variable,bcoz temp pointing to the count variable temp=∑ //Again we are assigning the new address to temp, so now temp will point the address of sum. *temp=count; //value of count variable is 20 & it will assign to sum variable(look at just above line). printf("%d %d %d ",count,*temp,sum); //all will be 20. }

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0