Originally Posted by
Adak
You know that P and Q are just copies of X and Y, right?
so in func(), why don't you print up the values of P and Q and X and whatever else interests you.
See what these variables are all doing.
You know that since *Q is the address of Y, that whatever you do to it, will be affecting Y, but that's not true with X since the func() is not getting the address for it.
If a function is to change the value of a variable, it has to know the address of that variable.
You see that in simple things like scanf("%d", &number). Since scanf() is going to change the value of number, you have to give it the address of number.
But: printf("%d", number) - no address needed, since printf() is not going to change the value of the variable number.