copying an **int array passed through parameters
Is there any other way to copy an array or rather 'pass by value'?
Heres what im currently doing, I do not like it much... (I need to work with the data in array but I can't have it changed once the method returns.
Code:
int dijkstra(int buildings,int **tempEdges)
{
//crude way of copying an array
int **edges;
edges = new int*[buildings+1];
for(int i=0;i <= buildings;++i)
edges[i] = new int[buildings+1];
for(int i=0;i <= buildings;++i)
for(int j=0;j <= buildings;++j)
edges[i][j] = tempEdges[i][j];
//jumble array around to work with it
//return value
}
Any ideas?