Object c 基本类型数据输出

1. int
输出格式符:%i, %d, %o %x, 

2. float
输出格式符:%f, %e, %g

3. double
输出格式符:%f, %e, %g


4. char

输出格式符:%c


5. char *

输出格式符:%s

 

限定符:


1. long
long int: %li
long double: %Lf
形成long int通过在数字后面加L.
long int number = 123324123234123L;

2. long long
long long int: %lli

3. short
short int: %hi

4. unsigned

5. signed

 

它们各自所占的字节数

 

#import <Foundation/Foundation.h>

 

int main (int argc, const char * argv[]) {

    NSAutoreleasePool * pool = [[NSAutoreleasePool allocinit];

 

NSLog(@"The size of an int is: %d bytes.",sizeof(int));

NSLog(@"The size of a short int is: %d bytes.",sizeof(short int));

NSLog(@"The size of a long int is: %d bytes.",sizeof(long int));

NSLog(@"The size of a char is: %d bytes.",sizeof(char));

NSLog(@"The size of a float is: %d bytes.",sizeof(float));

NSLog(@"The size of a double is: %d bytes.",sizeof(double));

NSLog(@"The size of a bool is: %d bytes.",sizeof(bool));

 

 

    [pool drain];

    return 0;

 

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值