外部申明部分老是抱错,ISO C++ forbids declaration of 'A'

charlie811hanson 2008-07-22 09:07:47
#include<stdio.h>
#include<math.h>
#include<conio.h>
int max(int a,int b)
{return a>b?a:b;}

int main()
{extern A,B;
printf("the max is %d",max(A,B));
getch();
}
int A=19,B=10;
外部申明部分老是抱错,ISO C++ forbids declaration of 'A'
...全文
141 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
chlaws 2008-07-23
  • 打赏
  • 举报
回复
LZ太不注意小细节了,注意把类型加上去
uaxion 2008-07-22
  • 打赏
  • 举报
回复
我在vc下编译运行都没问题。
我把程序改了一下
#include <stdio.h>
#include <math.h>
#include <conio.h>
int max(int a,int b)
{return a>b?a:b;}

int main()
{extern A,B;
printf("the max is %d",max(A,B));
getch();
}
char A=19,B=10;

还值得看看
xkyx_cn 2008-07-22
  • 打赏
  • 举报
回复
extern int A,B;

70,037

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧