Trouble with first array tutorial

I am using the array tutorial on this site and am having trouble getting the code to compile. Whenever I am using a tutorial like this I type the code in instead of copy/paste so that I might get a better understanding of the material. But after compairing what I have typed in dev-c++ to what is on the site I don't see anything wrong. The exxor I am getting is on line 4 and is, "expected primary-expression before '[' token.".

Any help will be greatly appreciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
using namespace std;

int billy[] = [16, 2, 77, 40, 12071];
int n, result=0;

int main ()
{
    for (n = 0; n<5; n++)
    {
        result +=billy[n];
        }
    cout << result
         << endl;
system("PAUSE");
return 0;
}
You should use braces at line 4:
int billy[] = {16, 2, 77, 40, 12071};
ok so:

int example [squared of]={squiggle};
gotcha, thanks
Last edited on
Topic archived. No new replies allowed.