请帮我看看这个程序吧,编译都成功了,还不能运行
main()
{
char* greeting="hello ";
char* name;
scanf("%s",name);
strcpy(greeting,name);
printf("%s",greeting);
}
指针是不可以读的,另外缺少头文件,根据你的上下文,我觉得你想用strcat连接字符串
完整的程序
#include <stdio.h>
#include <string.h>
int main()
{
char greeting[100]="hello ";
char name[100];
scanf("%s",name);
strcat(greeting,name);
printf("%s",greeting);
}
指针是不可以读的,另外缺少头文件,根据你的上下文,我觉得你想用strcat连接字符串
完整的程序
#include
#include
int main()
{
char greeting[100]="hello ";
char name[100];
scanf("%s",name);
strcat(greeting,name);
printf("%s",greeting);
}