下列字符数组长度为5的是()
A: char a[]={‘h’, ‘a’, ‘b’, ‘c’, ‘d’};
B: char b[]= {‘h’, ‘a’, ‘b’, ‘c’, ‘d’, ‘\0’};
C: char c[10]= {‘h’, ‘a’, ‘b’, ‘c’, ‘d’};
D: char d[6]= {‘h’, ‘a’, ‘b’, ‘c’, ‘\0’ }
A: char a[]={‘h’, ‘a’, ‘b’, ‘c’, ‘d’};
B: char b[]= {‘h’, ‘a’, ‘b’, ‘c’, ‘d’, ‘\0’};
C: char c[10]= {‘h’, ‘a’, ‘b’, ‘c’, ‘d’};
D: char d[6]= {‘h’, ‘a’, ‘b’, ‘c’, ‘\0’ }
举一反三
- 下列字符数组长度为5的是() A: char a[]={‘h’, ‘a’, ‘b’, ‘c’, ‘d’}; B: char b[]= {‘h’, ‘a’, ‘b’, ‘c’, ‘d’, ‘\0’}; C: char c[10]= {‘h’, ‘a’, ‘b’, ‘c’, ‘d’}; D: char d[6]= {‘h’, ‘a’, ‘b’, ‘c’, ‘\0’ }
- 下列数组不是字符串的是()。 A: char a[]="China"; B: char a[5]={'C','h','i','n','a'}; C: char a[6]={'C','h','i','n','a','\0'}; D: char a[7]={'C','h','i','n','a'};
- 下列数组不是字符串的是()。 A: char b[]="hi"; B: char b[5]="a"; C: char b[6]={'C','h','i','n','a','\0'}; D: char b[5]={'C','h','i','n','a'}
- char str[]=“China”; 等价于 A: char str[5]={‘C’, ‘h’, ‘i’, ‘n’, ‘a’,’0’}; B: char str[6]={‘C’, ‘h’, ‘i’, ‘n’, ‘a’,’0’}; C: char str[5]={‘C’, ‘h’, ‘i’, ‘n’, ‘a’}; D: char str[6]={‘C’, ‘h’, ‘i’, ‘n’, ‘a’};
- 字符串""可以用字符数组来定义,如字符串“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”};