NSString *greeting = @"hello, object-c";
NSString *greeting2 = @"hello,\
object-c";
NSString *greeting3 = @"hello," " object-c";
NSLog(@"\n%@\n%@\n%@",greeting,greeting2,greeting3);
//使用反斜杠换行写字符串的时候,输出会多出来一个制表符?输出结果如下
//hello, object-c
//hello, object-c
//hello, object-c
加反斜杠会输出多一段空白,不知为何
int age = 021;
//开头为0表示是八进制,021的值为17
int weight = 0xaf8;
//开头为0x表示是16进制,0xaf8的值为2808
NSLog(@"age = %d",age);
NSLog(@"weight = %d",weight);
char tab = '\t';
char newLine = '\n';
NSLog(@"hello,%cmy%cfriend",tab,newLine);
八进制和16进制的表示方法,以及用char类型储存制表符和换行符
来源:CSDN
作者:camel_4197
链接:https://blog.csdn.net/camel_4197/article/details/104135892