下段代码的运行结果是:
intmain()
{
chara;
char*str=&a;
strcpy(str,"hello");
puts(str);
return0;
}
intmain()
{
chara;
char*str=&a;
strcpy(str,"hello");
puts(str);
return0;
}
举一反三
- 下列关于字符串使用正确的是() A: char str[10]; str="Hello"; B: char *str; strcpy(str,"Hello"); C: char *str1,str[10]="Hello"; strcpy(str,str1); D: char *str; str="Hello";
- 下面哪个选项不能将"hello"字符串存入字符数组str中( )。 A: char str[]="hello" ; B: char str[30]; strcpy(str, "hello"); C: char str[30];str="hello"; D: char str[30],*ps=str; strcpy(ps,"hello");
- 以下程序的输出结果是 _[13]_______ . #include #include char *fun(char *t) { char *p=t; return(p+strlen(t)/2); } main() { char *str="abcdefgh"; str=fun(str); puts(str); }
- 若有定义char str[8]; ,以下正确的语句是()。 A: str[8]= "Hello C"; B: str="Hello C"; C: str[]="Hello C"; D: strcpy(str,"Hello C");
- 列不能正确进行字符串赋值操作的语句是 未知类型:{'options': ['char str[10];gets(str);', 'char *str;str="a"', "char*str;str='a';", 'charstr[10];strcpy(str,"hello");'], 'type': 102}