若有定义char s[5] = { 'h', 'e', 'l', 'l', 'o' };则printf(“%s”,s);的输出结果为( )
A: h
B: 输出数组s的地址
C: 输出字符串hello后乱码
D: hello
A: h
B: 输出数组s的地址
C: 输出字符串hello后乱码
D: hello
举一反三
- 若有定义chars[5]={'h','e','l','l','o'};则printf(“%s”,s);的输出结果为() A: A、输出字符串hello后乱码 B: B、hello C: C、h D: D、输出数组s的地址
- 字符串""可以用字符数组来定义,如字符串“hello”可以用字符数组定义为以下哪种形式 A: char a[6]={‘h’,‘e’,‘l’,‘l’,‘o’,‘\0’}; B: char a[5]={‘h’,‘e’,‘l’,‘l’,‘o’}; C: char a[6]= {“hello”}; D: char a[5]= {“hello”};
- 下面各语句行中,能正确进行字符串赋值操作的语句是: A: char *s;scanf("%s",s); B: char st[4][5]={"HELLO"}; C: char s[5]={'H', 'E', 'L', 'L', 'O'}; D: char * s;s="HELLO";
- 以下程序段的输出结果是 。Char s[ ]=”Hello World!”;Strlwr(s);Printf(“%s”,s); A: hello world! B: HELLO world! C: hello WORLD! D: HELLO WORLD!
- 若有定义char s[] = {“hello”};则sizeof(s)的大小为5。