注意:C++ 不支持 default-int [英] Note: C++ does not support default-int

查看:31
本文介绍了注意:C++ 不支持 default-int的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 中收到此消息:

I'm getting this message in Visual Studio:

注意:C++ 不支持 default-int

Note: C++ does not support default-int

我的 C 代码有什么问题?

What's wrong with my C code?

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

void remplire (int t[], int n);
void afficher (int t[], int n);

void main ()
{
    const long_tab = 2000;
    int t[long_tab];
    srand (time(NULL));
    remplire (t, long_tab);
    afficher (t, long_tab);
}

void remplire (int t[], int n)
{
    int i;
    for (i = 0; i <= n; i++)
    {
        t[i] = rand (); 
    }
}

void afficher (int t[], int n)
{
    int i;
    for (i = 0; i <= n; i++)
    {
        printf ("%d \t", t[i]);
        if (i % 10 == 0)
            printf ("\n");
    }
}

推荐答案

当您省略标识符类型时,C++ 会显示此错误.

C++ shows this error when you omit the identifier type.

const int variable1; //OK
const variable2; //Not OK

这是错误的 MSDN 描述:

This is MSDN description of the error:

http://msdn.microsoft.com/en-us/library/ms173696%28VS.80%29.aspx

此外,如果您在输出选项卡中突出显示错误并按 F1 - Visual Studio 帮助将显示一个页面,更详细地解释错误,类似于上面的链接.

Also, if you highlight the error in the output tab and press F1 - Visual Studio Help will show you a page explaining the error in more detail, similar to the link above.

这篇关于注意:C++ 不支持 default-int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆