我是 C 的新手,我正在尝试使用全局变量我运行了这个程序,所有的输出都是“嘿,那里”,这是程序的第一部分。第二部分不显示。这是代码。
char count[20]="Hey there";
char dig[7]="pooop";
main()
{
puts(count);
return(0);
}
hey()
{
printf(" i %s you", dig);
return(0);
}
最佳答案
您需要调用第二个函数 hey()
才能获得它的输出。
例如,在main()
{
puts(count);
hey();
return 0;
}
在 main()
中调用 hey()
的确切位置由您决定(它需要在 return
之前虽然声明)。
关于c - 这个C程序有什么问题? (全局变量),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11388333/