单选题
下列4个程序中,完全正确的是( )。
A、
#include<stdio.h> main(); {/*programming*/ printf("programming!\n");}
B、
#include<stdio.h> main() {/*/programming/*/ printf("programming!\n");}
C、
#include<stdio.h> main() {/*/ programming*/*/ printf("programming!\n");}
D、
include<stdio.h> main() {/*programming*/ printf("programming!\n");}
【正确答案】
B
【答案解析】
解析:选项jA)中,main()函数后面的分号是错误的,C语言在函数名后面不能有分号;在C语言中注释内容必须放在“/*”和“*/”之间,“/*”和“*/”必须成对出现,按语法规定在注释之间不可再嵌套“/*”和“*/”,选项C)的程序段中注释语句之间有嵌套;C语言用#include命令行来实现文件包含的功能。#include命令行的形式为:#include“文件名”,选项D)中的include前面少了一个#符号。
提交答案
关闭