#import "ViewController.h"
#import
#import
@interface ViewController ()
@end
@implementation ViewController
-
(void)viewDidLoad {
[super viewDidLoad];int ar = 235;
int add = (int)objc_msgSend(self, NSSelectorFromString(@"addValue:"), (int)&ar);
NSLog(@"add = %d", add);
// Do any additional setup after loading the view, typically from a nib.
} (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}(int)addValue:(int)a{
int c = a;
return a;
}
@end
打印出来的a = 9,而不是235.
求答案,为什么?