how to copy an array into somewhere else in the memory by using the pointer
        Posted  
        
            by 
                user2758510
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user2758510
        
        
        
        Published on 2013-11-03T09:22:22Z
        Indexed on 
            2013/11/03
            9:53 UTC
        
        
        Read the original article
        Hit count: 187
        
c++
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.
© Stack Overflow or respective owner