I want to send an array to a function then print all of the elements. I have an error.
.LST file is:
BACI System: C-- to PCODE Compiler, 16:59 27 Oct 2005 Source file: 1.cm Fri Nov 01 03:16:20 2019 line pc 1 0
2 0
3 0
4 0 void Print(int a[]) Error near '[', line 4 of file 1.cm: ** syntax error Because of 1 error the PCODE file will not execute
Baci reference is: http://inside.mines.edu/~tcamp/baci/baci_index.html
C:\badosxe> bacc 1.cm Error near '[', line 4 of file 1.cm: ** syntax error>>Because of 1 error the PCODE file will not execute Pcode and tables are stored in 1.pco Compilation listing is stored in 1.lst
void Print(int a[])
{
int i;
for (i = 0; i < 5; i = i + 1)
{
cout<<a[i];
}
}
main()
{
cout << endl;
cobegin
{
int a[5] = {1,2,3,4,5};
Print(a);
}
}