小编jus*_*tin的帖子

为什么Visual Studio C编译器不是这样的?

以下代码使用gcc -std = c99在Linux上编译正常但在Visual Studio 2010 C编译器上获得以下错误:

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

fib.c
fib.c(42) : error C2057: expected constant expression
fib.c(42) : error C2466: cannot allocate an array of constant size 0
fib.c(42) : error C2133: 'num' : unknown size

用户输入要生成的斐波那契数量.我很好奇微软编译器为什么不喜欢这段代码.

#include <stdlib.h>
#include <stdio.h>
#include <limits.h>

void fib(int max);

int main(int argc, char *argv[])
{    
    int argument;

    if (argc != 2)
    {
        puts("You must supply exactly one …
Run Code Online (Sandbox Code Playgroud)

c compiler-construction c99 visual-studio

2
推荐指数
1
解决办法
1119
查看次数

标签 统计

c ×1

c99 ×1

compiler-construction ×1

visual-studio ×1