You can't do a memcpy on 2d array, actually it's array of pointers to other arrays. This can be useful in following context:
char **newArray = new char*[5];
for( int i=0; i<5; i++)
{
newArray[i] = new char[5];
memcpy( sourceArray[i], newArray[i], sizeof(char)*5 );
}
Main Topics
Browse All Topics





by: MercantilumPosted on 2004-06-02 at 06:22:44ID: 11212023
Use
NAME
memcpy - copy memory area
SYNOPSIS
#include <string.h>
e.g.
memcpy (y, x, sizeof(x));