Mail Archives: djgpp/1998/09/17/16:45:26
¤ý¤ô wrote:
>
> void change(char *n){
> *n=70;
> }
> int main(){
> char Number=0;
> printf("Number=%i\n",Number);
> change(&Number);
> printf("Number=%i\n",Number);
> return 0;
>
> What I want to ask is that when the address of Number pass to function
> "change", the address value will store in var 'n' , but not '*n' ?!
>
> Damn, I don't know how to say it....... :(
Yes, you have it right. 'n' in change() contains &Number (the address of
Number), so the line
*n = 70;
has the effect of
*(&Number) = 70;
or
*&Number = 70;
or
Number = 70;
--
Martin Ambuhl (mambuhl AT earthlink DOT net)
Note: mambuhl AT tiac DOT net will soon be inactive
- Raw text -