| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 568 人关注过本帖
标题:编译器之间的差别
取消只看楼主 加入收藏
三个人
Rank: 2
等 级:论坛游民
帖 子:54
专家分:40
注 册:2014-7-6
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:1 
编译器之间的差别
#include <stdio.h>  
  
int main()  
{  
    int n,num,i;  
    scanf("%d %d",&n,&num);  
      
    const int N = n;  
    int a[N];  
    for(i=0;i<N;i++){  
        scanf("%d",&a[i]);  
    }  
    int flag = 1;  
    for(i=0;i<N;i++){  
        if(a[i]==num){  
            printf("%d",i);  
            flag = 0;  
        }  
    }  
    if(flag) printf("Not Found\n");  
    return 0;  
}  
以上这段代码,在gcc上没问题,但是在vc6上一堆错误,到底是为什么。。实在搞不懂。。。
搜索更多相关主题的帖子: include 编译器 return 
2014-08-04 11:52
三个人
Rank: 2
等 级:论坛游民
帖 子:54
专家分:40
注 册:2014-7-6
收藏
得分:0 
:\2\2.c(8) : error C2143: syntax error : missing ';' before 'const'
E:\2\2.c(9) : error C2143: syntax error : missing ';' before 'type'
E:\2\2.c(10) : error C2065: 'N' : undeclared identifier
E:\2\2.c(11) : error C2065: 'a' : undeclared identifier
E:\2\2.c(11) : error C2109: subscript requires array or pointer type
E:\2\2.c(11) : error C2102: '&' requires l-value
E:\2\2.c(13) : error C2143: syntax error : missing ';' before 'type'
E:\2\2.c(15) : error C2109: subscript requires array or pointer type
E:\2\2.c(17) : error C2065: 'flag' : undeclared identifier
执行 cl.exe 时出错.

2.exe - 1 error(s), 0 warning(s)
2014-08-04 12:00
快速回复:编译器之间的差别
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015653 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved