ASC C之后引入的一个特性是,相邻的字符可以被自动连接
1 /* printf.cc 2 * 2014/09/02 update 3 */ 4 #include <iostream> 5 using namespace std; 6 7 int main() { 8 printf("abcd" 9 "efg "); 10 11 char* var[] = { 12 "adf", 13 "def" //没有逗号,故自动连接在一起 14 "ghi", 15 }; 16 17 //sizeof(var)为8 18 //sizeof(var[0])为4 19 printf("size of var is: %d ", sizeof(var)/sizeof(var[0])); 20 21 for(size_t sz = 0; sz < sizeof(var)/sizeof(var[0]); sz++) 22 cout << var[sz] << endl; 23 24 int p = 2; 25 size_t apple = sizeof(int) * p; 26 printf("apple is: %d ", apple); 27 28 int q = 3; 29 int res = p+++q; 30 printf("res is: %d ", res); 31 32 struct pig_id { 33 unsigned int a; 34 }; 35 return 0; 36 }
$ ./a.exe abcdefg size of var is: 8 adf defghi apple is: 8 res is: 5