#import <Foundation/Foundation.h>
typedef enum{
SexMan,
SexWomen
}Sex;
typedef struct
{
int year;
int month;
int day;
}Date;
@interface Student:NSObject
{ @public
Sex sex;
double weight;
Date birthday;
char *name;
}
-(void)eat;
-(void)run;
@end
@implementation Student
-(void)eat
{
weight +=1;
NSLog(@"现在是%d斤",weight);
}
-(void)run
{
weight -=1;
NSLog(@"现在是%d斤",weight);
}
@end
int main()
{
Student *p = [Student new];
p->weight=50;
p ->sex =SexMan;
p->birthday.year =2011;
p->birthday.month = 12;
p ->birthday.day = 16;
[p run];
[p eat];
return 0;
}
报错原因:Codeponit out of the rage of the constant string
我想问下,我是在Codeblock里编译的,这个错误是什么意思? |