首页 > 代码库 > oc基本数据类型例子

oc基本数据类型例子

        //基本数据类型        int i = 10;        float f = 3.1567f;        double d = 3.123e+11;        char c = x;                NSLog(@"i:%d",i);        NSLog(@"f:%.2f",f);//打印两位小数        NSLog(@"d:%e",d);        NSLog(@"c:%c",c);                //打印x的ASCII值        NSLog(@"x ascii:%d",c);  //120                //打印数据类型所占用的字节        NSLog(@"i sizeof:%ld",sizeof(i));        NSLog(@"f sizeof:%ld",sizeof(f));        NSLog(@"d sizeof:%ld",sizeof(d));        NSLog(@"c sizeof:%ld",sizeof(c));

 

oc基本数据类型例子