N
needin4mation
Hi, in this statement:
int num1, *ptr;
num1=50;
ptr=&num1;
*ptr = (*ptr+25);
The indirection operator in (*ptr+25) says take the value that is held
in the address pointed to *ptr (which is the address of num1 the value
being 50).
So what does the *ptr on the left side of the assignment do? Is it
saying take the result of the right side (75) and assign it to the
location in memory pointed to by *ptr (or &num1)?
int num1, *ptr;
num1=50;
ptr=&num1;
*ptr = (*ptr+25);
The indirection operator in (*ptr+25) says take the value that is held
in the address pointed to *ptr (which is the address of num1 the value
being 50).
So what does the *ptr on the left side of the assignment do? Is it
saying take the result of the right side (75) and assign it to the
location in memory pointed to by *ptr (or &num1)?