Note: C++ does not support default-int
I'm getting this message in Visual Studio:
Note: C++ does not support default-int
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 =开发者_如何学Python= 0)
printf ("\n");
}
}
C++ shows this error when you omit the identifier type.
const int variable1; //OK
const variable2; //Not OK
This is MSDN description of the error:
http://msdn.microsoft.com/en-us/library/ms173696%28VS.80%29.aspx
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.
const long_tab = 2000
should be const int long_tab = 2000
. You may have other problems too, but I can't easily read your code because it got badly reformatted by SO.
精彩评论