| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 505 人关注过本帖
标题:请问有谁知道如何在VC++6.0中运行C语言中的变长数组?
只看楼主 加入收藏
笑忘书
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2014-2-24
结帖率:0
收藏
 问题点数:0 回复次数:0 
请问有谁知道如何在VC++6.0中运行C语言中的变长数组?
程序是这样的:
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int i, n;

    printf("How many numbers do you want to reverse: ");
    scanf("%d", &n);

    int a[n];

    printf("Enter %d numbers: ", n);
    for (i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    printf("In reverse order: ");
    for (i = n-1; i>=0; i--)
    {
        printf("%d", a[i]);
    }
    printf("\n");

    system("pause");
    return 0;
}

编译显示:
         --------------------Configuration: asasqasq - Win32 Debug--------------------
Compiling...
sadada.c
E:\安装位置\VC++6.0\测试\asasqasq\sadada.c(11) : error C2143: syntax error : missing ';' before 'type'
E:\安装位置\VC++6.0\测试\asasqasq\sadada.c(16) : error C2065: 'a' : undeclared identifier
E:\安装位置\VC++6.0\测试\asasqasq\sadada.c(16) : error C2109: subscript requires array or pointer type
E:\安装位置\VC++6.0\测试\asasqasq\sadada.c(16) : error C2102: '&' requires l-value
E:\安装位置\VC++6.0\测试\asasqasq\sadada.c(21) : error C2109: subscript requires array or pointer type
执行 cl.exe 时出错.

asasqasq.exe - 1 error(s), 0 warning(s)
搜索更多相关主题的帖子: C语言 return system numbers include 
2014-02-24 13:05
快速回复:请问有谁知道如何在VC++6.0中运行C语言中的变长数组?
数据加载中...
 
   



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

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