首页 > 试题广场 >

下列说法正确的是( &nbs...

[单选题]
下列说法正确的是(      )
#include "stdio.h"
#include "string.h"

void fun( char *s)
{
char t[7];
s=t;
strcpy(s, "example");
}

int  main()
{
char *s;

fun(s);
printf("%s",s);

return 0;
}
  • 输出结果为"example"
  • 输出结果为"烫烫烫烫"
  • 程序编译时出现错误
  • 程序运行时出现错误
这个应该是程序编译时出现错误,因为s是未初始化的局部变量。编译阶段会进行词法分析、语法分析、语义分析,会提示使用了未初始化的局部变量。
发表于 2019-10-18 19:25:15 回复(0)
VS2013报s没有初始化错误
发表于 2019-08-22 16:49:06 回复(0)