参考答案和解析
正确答案:ACD
更多“定义chars[81];后,能正确输入一个字符串到数组s的语句是()。 ”相关问题
  • 第1题:

    下列是为字符数组赋字符串的语句组,其中错误是:

    A.char s[10]; s=”program”;

    B.char s[]=”program”;

    C.char s[10]=”Hello!”;

    D.char s[10];strcpy(s,”hello!”);


    char s[10]; s= ” program ” ;

  • 第2题:

    请编写函数cpy(char s1[ ], char s2[ ]),其功能是实现字符串的复制(不能使用库函数strcpy), 即把字符数组s2中的字符串复制到字符数组s1中。 例如main函数中输入"hello",“world”,则最后输出``world” ;


    字符串复制

  • 第3题:

    5、下列是为字符数组赋字符串的语句组,其中错误是:

    A.char s[10]; s=”program”;

    B.char s[]=”program”;

    C.char s[10]=”Hello!”;

    D.char s[10];strcpy(s,”hello!”);


    char s[10]; s= ” program ” ;

  • 第4题:

    1.定义一个名为s的字符型数组,并且赋值为字符串"123"的错误语句是 。

    A.char s[]={ '1', '2', '3', '0'};

    B.char s[]={ "123"};

    C.char s[3]={ '1', '2', '3'};

    D.char s[4]={ '1', '2', '3'};


    CC答案中,虽然s字符数组也存放了串,但它存放的串不是“123”。

  • 第5题:

    下列各语句行中,能正确进行赋字符串操作的语句是()

    A.char s[5]={"ABCDE"};

    B.char s[5]={'A' ,'B','C','D','E'};

    C.char *s; s="ABCDE";

    D.char *s; *s="ABCDE";


    char *s; s="ABCDE";