gpt4 book ai didi

c - 如何指定正确的 'return type' ?

转载 作者:太空宇宙 更新时间:2023-11-04 06:13:59 27 4
gpt4 key购买 nike

<分区>

我有一个生成错误消息的 C 程序:

p3-static-store-class.c:5:1 warning: return type defaults to 'int' [- Wimplicit-int] main()

突出显示警告并用箭头突出显示 main() 中的 m。代码是:

#include <stdio.h>
/* function declaration */
void func(void);
static int count = 5; /* global variable */
main()
{
while(count--)
{
func();
}
return 0;
}

/* function definition */
void func(void)
{
static int i = 5; /* local static variable */
i++;
printf("i is %d and count is %d\n", i, count);
}

我指定返回类型的尝试产生了错误消息列表,C 语法与我习惯的完全不同 - 那么对此有什么补救措施?

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com