鱼C论坛

 找回密码
 立即注册
查看: 4798|回复: 4

跪求各位大哥指点

[复制链接]
发表于 2013-7-27 11:25:54 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
#include <stdio.h>
void main;
{
     printf("This is a C program.\n")
}



问题Compiling...
he141.c
F:\qq\he141\he141.c(3) : error C2182: 'main' : illegal use of type 'void'
F:\qq\he141\he141.c(5) : error C2449: found '{' at file scope (missing function header?)
F:\qq\he141\he141.c(7) : error C2059: syntax error : '}'
Error executing cl.exe.
he141.obj - 3 error(s), 0 warning(s)


真的不知道问题在哪里
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2013-7-27 12:04:01 | 显示全部楼层
void main后面不能带有分号的  改成小括号
void main()就行了
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2013-7-27 12:04:55 | 显示全部楼层
还有printf语句后面缺少分号
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2013-7-27 12:07:37 | 显示全部楼层
最终正确的程序应该是这样的
#include<stdio.h>
void main()
{
        printf("This is a C progream.\n");
}
建议楼主把C语言基础知识好好看看:lol
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2013-7-27 12:26:47 | 显示全部楼层
#include <stdio.h>


int main(int argc,const char *argv[])
{
        printf("This is a C program.\n");
        return 0;
}

void main()这样写不好吧,int main(void)吧,最后return 0 ;
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2026-2-4 07:12

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表