- #1
villiami
- 27
- 0
Have read a million different sites and threads, but still not getting anywhere (damn 1st year java makes addresses incomprehensible!).
What changes do I need to make to get these c++ functions to work? //---------Functions
//-- A function to increment the (n,m) element
void flipsite(double* pgrid[][10], int n, int m)
{*pgrid[n][m] = *pgrid[n][m] + 1;
}
//-- function to output the array. A form using pointers is fine if that's easier.
double[][10] newgrid(double grid[][10])
{return grid;
}//--------------
void main() {
// I first define an array like:
double grid[5][10];
double grid2[5][10]
flipsite(grid,1,1);
grid2 = newgrid(grid);
std::cout << grid[1][1] << ", " << grid2[1][1] << std::endl; //should output "1, 1"
}
//Thanks!
What changes do I need to make to get these c++ functions to work? //---------Functions
//-- A function to increment the (n,m) element
void flipsite(double* pgrid[][10], int n, int m)
{*pgrid[n][m] = *pgrid[n][m] + 1;
}
//-- function to output the array. A form using pointers is fine if that's easier.
double[][10] newgrid(double grid[][10])
{return grid;
}//--------------
void main() {
// I first define an array like:
double grid[5][10];
double grid2[5][10]
flipsite(grid,1,1);
grid2 = newgrid(grid);
std::cout << grid[1][1] << ", " << grid2[1][1] << std::endl; //should output "1, 1"
}
//Thanks!