char * to char array

how to copy content of character pointer to character array in c programming..
Assuming the array is large enough to contain the entire string, you'd use strcpy:

1
2
3
4
const char* ptr = "Pointer to some string data";
char array[100];  // <- must be large enough to contain the string data

strcpy(array,ptr); // <- copies the string data from ptr to array 
Topic archived. No new replies allowed.