object-c 基本数据类型-1
? ? ? ?//数据类型:
? ? ? ? //整形(int、short int、long int、unsigned int、unsigned short、unsigned long)
? ? ? ? NSLog(@"整形:");
? ? ? ? NSLog(@"%lu",sizeof(int));//整形4个字节
? ? ? ? NSLog(@"%lu",sizeof(short int));//短整形2
? ? ? ? NSLog(@"%lu",sizeof(long int));//长整形8
? ? ? ? NSLog(@"%lu",sizeof(unsigned int));//无符号整形4
? ? ? ? NSLog(@"%lu",sizeof(unsigned short));//无符号短整形2
? ? ? ? NSLog(@"%lu",sizeof(unsigned long));//无符号长整形8
? ? ? ? //实形(float 、double 、long double)
? ? ? ? NSLog(@"实形:");
? ? ? ? NSLog(@"%lu",sizeof(float));//浮点形4
? ? ? ? NSLog(@"%lu",sizeof(double));//双精度形8
? ? ? ? NSLog(@"%lu",sizeof(long double));//长精度形16
? ? ? ? //字符型和字符串形?
? ? ? ? char a='a';
? ? ? ? char b=100;
? ? ? ? NSLog(@"%c,%c",a,b);
? ? ? ? NSLog(@"%i,%i",a,b);
? ? ? ? NSLog(@"我是字符串");//字符串形:@“我是字符串”
?
?
?
http://blog.csdn.net/rhljiayou/article/details/7397889