for语句中,如果里边只有一行内容,for语句可以不用加花括号,如果有多行内容,必须加花括号。如下:
for( ; ; ) printf("hello"); // 1
for( ; ; ) { printf("hello"); } //2
for( ; ; ) { printf("hello"); printf("hello");} //3
上述三种写法都是正确的
for( ; ; ) printf("hello"); printf("Bob");
上述写法中,for语句中的内容只有第一个printf。