Got*_*est 5 c program-entry-point function output
我试着跑这个
int array( void )
{
char text[12] = { 112, 114, 111, 103, 112, 0 };
int i;
for(i = 0; text[i]; i = i +1)
printf("%c", text[i]);
printf("\n");
return 0;
}
int main( void )
{
int array(void);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
程序运行,但我没有结果.现在当我使用main函数定义程序时:
int main( void )
{
char text[12] = { 112, 114, 111, 112, 0 };
int i;
for(i = 0; text[i]; i = i +1)
printf("%c", text[i]);
printf("\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我得到了结果progr(按照需要).我已经搜索过,但我发现的唯一相关问题是关于使用main函数名称和输出错误.也许我正在寻找错误的方式,但如果有人能够回答这个问题,我会很高兴.