标签:
关键字typedef
1 int main(int argc, const char * argv[]) { 2 typedef int integer; 3 integer i = 5; 4 printf("print the int: %d\n", i); 5 6 return 0; 7 }
1 typedef char * String; 2 String name = "Simon”;
1 typedef struct MyPoint 2 { 3 int x; 4 int y; 5 } Point; 6 7 Point p = {10, 10};
1 typedef struct 2 { 3 int age; 4 char *name; 5 } * PP; 6 7 PP per1 = {11, "Tom"};//Running Error
1 int main(int argc, const char * argv[]) { 2 @autoreleasepool { 3 typedef struct{ 4 int age; 5 char *name; 6 } PP,*Person; 7 8 Person p = malloc(sizeof(PP)); 9 p->age = 12; 10 p->name = "simon"; 11 12 printf("%d - %s\n", p->age, p->name); 13 } 14 return 0; 15 }
1 typedef char * String1 2 #define String2 char * 3 4 String1 s1,s2; 5 String2 s3,s4;
标签:
原文地址:http://www.cnblogs.com/wvqusrtg/p/4501125.html