Hey guys, I am receiving these errors and can't seem to fix them. Help would be very much appreciated!
Here is my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
Blood::Blood(Vessel vessels[], int vesselCount, int cellCount, int depth)
{
int **nodePtr = new int[5000]={NULL};
int src;
int x = 0;
for(int i = 0; i < vesselCount; i++)
{
nodePtr[i] = new int[2]={NULL};//creating a 2D array off of the primary array
}//for
for(int i = 0; i < vesselCount; i++)
{
src = vessels[i].src;
if(nodePtr[src][x][0] != NULL)
x++;
nodePtr[src][x][0] = vessels[i].dest;
nodePtr[src][x][1] = vessels[i].capacity;
}//for
//printing
for(int i; i != NULL; i++)
{
for(int j; j != NULL; j++)
{
cout << nodePtr[i][j][0] << endl;
cout << nodePtr[i][j][1] << endl;
}//for
}//for
// void print(nodePtr);
} // Blood()
|
And here are the error messages I am getting:
g++ -Wall -ansi -g -c blood.cpp
blood.cpp: In constructor 'Blood::Blood(Vessel*, int, int, int)':
blood.cpp:28: error: expected primary-expression before '{' token
blood.cpp:28: error: expected ',' or ';' before '{' token
blood.cpp:33: error: expected primary-expression before '{' token
blood.cpp:33: error: expected `;' before '{' token
blood.cpp:39: error: invalid types 'int[int]' for array subscript
blood.cpp:39: error: 'NULL' was not declared in this scope
blood.cpp:42: error: invalid types 'int[int]' for array subscript
blood.cpp:43: error: invalid types 'int[int]' for array subscript
blood.cpp:47: error: 'NULL' was not declared in this scope
blood.cpp:51: error: 'cout' was not declared in this scope
blood.cpp:51: error: invalid types 'int[int]' for array subscript
blood.cpp:51: error: 'endl' was not declared in this scope
blood.cpp:52: error: invalid types 'int[int]' for array subscript
make: *** [blood.o] Error 1
Thanks in advance!