how to copy an array into somewhere else in the memory by using the pointer
- by user2758510
I am completely new in c++ programming. I want to copy the array called distances into where pointer is pointing to and then I want to print out the resul to see if it is worked or not.
this is what I have done:
int distances[4][6]={{1,0,0,0,1,0},{1,1,0,0,1,1},{1,0,0,0,0,0},{1,1,0,1,0,0}};
int *ptr;
ptr = new int[sizeof(distances[0])];
for(int i=0; i<sizeof(distances[0]); i++){
ptr=distances[i];
ptr++;
}
I do not know how to print out the contents of the pointer to see how it works.