12-4 若已定义:char str[20];,能正确从键盘读入字符串的是
举一反三
- ( )不能对字符串赋初值.A) char str[5]="good!"; B) char str[]="good!";C) char *str="good!"; D) char str[ ]={‘g',‘o',‘o',‘d',‘!',‘\0'}; A: char str[5]="good!"; B: char str[]="good!"; C: char *str="good!"; D: char str[ ]={‘g',‘o',‘o',‘d',‘!',‘\0'};
- 以下不能正确进行字符串赋初值的语句是( )。 A、char str[5]= "good!"; B、char *str="good!"; C、char str[]="good!"; D、char str[5]={'g', 'o','o', 'd'}; A: char *str="good!"; B: char str[5]={'g', 'o','o', 'd'}; C: char str[]="good!"; D: char str[5]= "good!";
- 若定义char a[10][20];,则a数组可以存储10个字符串,每个字符串的长度至多为20。
- 若有定义语句:char str[]="0";,则字符串str在内存中实际占_______个字节
- 设定义字符数组:char str[]=”s=%d ”;则数组str中的元素个数为___。