1. //a --->ff01,address:ff01,value:10
char a=10;
changeA(a);
// NSLog(@"%i",a);//10,addressff01,value:10
void changeA(char a)
{
//a----->ff02,地址为ff02,值为20
a=20;
}
2.
//a1----->ff03 address:ff03,value:10
char a1=10;
//&a1---&ff03
changeAPoniter(&a1);
//a1---->ff03 address:ff03,value:20
NSLog(@"%i",a1);
void changeAPoniter(char* a)
{
//*a---->access address ff03,set value:20;
*a=20;
}
3.
//s1---->ff04 address:ff04,value:ff05(@"ss" 's address)
//@"ss"---->ff05 address:ff05,value:ss
NSString *s1=@"ss";
//changeS change s1's address from ff05 to ff06,so s1 not change value
changeS(s1);
//&s1------>ff05(@"ss"'s address),s1's value
changeSPointer(&s1);
NSLog(@"%@",s1);
void changeS(NSString *s)
{
//s 's address change from ff05 to ff06(@"aa"'s address)
//@"aa"---->ff06 address:ff06 value:"aa"
s=@"aa";
}
void changeSPointer(NSString **s)
{
*s=@"aa";
}