Copy unsigned char array

user2829 picture user2829 · Dec 22, 2010 · Viewed 31.1k times · Source

What would be the best way to copy unsigned char array to another?

For example:

unsigned char q[1000];
unsigned char p[1000];

strcpy (q,&p);

The above code does not work, it gives me error saying "cannot convert parameter 1 from unsigned char [1000] to char *".

Answer

icecrime picture icecrime · Dec 22, 2010

As indicated by its name, strcpy works on C string (which a unsigned char array is not).

You should consider memcpy.