can anybody help me make a program that does this:
the program asks the user to enter an address(referring to integer address). The address is stored in a temporary int variable, and then copied to the integer pointer.
as of now all i can do is this
int x=8;
int *x_ptr= &x;
printf("Address of x: %p \n", x_ptr); //%p will give you the address
printf("Value of x: %d \n", *x_ptr);
the program asks the user to enter an address(referring to integer address). The address is stored in a temporary int variable, and then copied to the integer pointer.
*twitch*
This is an assignment? Who in their right mind would teach this?
Basically he's telling you to do this:
- get an integer from the user
- cast this integer to a int* and assign it to a int* (hint: don't use the & operator)