首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

object-c 根本数据类型-1

2013-03-13 
object-c 基本数据类型-1? ? ? ?//数据类型:? ? ? ? //整形(int、short int、long int、unsigned int、unsigne

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

热点排行