Given the following declarations int i =3, j, *iptr;
the following statement is intended to assign value of i to j
j = *iptr;
however this will not work unless preceded by another statment.
write the required preceding statement.
Given the following declarations int i =3, j, *iptr;
the following statement is intended to assign value of i to j
j = *iptr;
however this will not work unless preceded by another statment.
write the required preceding statement.
Follow this link, read, and do your own homework.
int i = 3 That's perfectly clear
int j; value of j is uninitialized, could be any whole number atm
int *iptr; same as j, it has not been given an address yet, could be any address.
iptr is an address, so what is *iptr? It's the value of what is at that address.
Which of course, the address of i is what you need. Wouldn't it be handy if we had an address of operator in C?
Oh, we do!