I’m trying to define an array of type char
char data[][]
I want to use it to store some data from another array using strcpy()
The problem is I don’t know exactly what is the length and I can’t specify the length in the array, and I’m getting this error:
Error array type has incomplete element type
Here’s the full code:
int bit_to_ascii(const char core[], char data[])
{
char char_data2[][];
strcpy(char_data2, core);
len1 = strlen(char_data2);
}
You either declare it with maximum size possible and acceptable for your case, or use
malloc(3)to ask the runtime to dynamically allocate exact amount of memory for you (then release that memory withfree(3)when done).