Trying to copy a char *str to char c[] but getting segmentation fault or invalid initializer error.
Why is this code is giving me a
char c[] must have some size;
for example
char c[]= "example init string";
// that set up table c to c[19]; You can allocate it directly at the begginign of Your program;
char c[19] = {0}; // null filled table
char c[i] is the pointer so You don't need to copy anything; char c[19] ; c = "example init string"; // now &c[0] points the same address;
Copy can be done wiht
strcpy(dst, src);
but MS force You to use secure function:
strcpy_s(dst,buffsize,src);