Why is this giving me a problem? How can I fix it? I'm basically passing a size containing a value of 2 to the makeArray function. Then I make an unsigned char* array Inside the makeArray function, fill its first two subscript, then return that array to main.cc.
Error:
main.cc:13:8: error: array type 'unsigned char *[size]' is not assignable
array = makeArray(size);
~~~~~ ^
1 error generated.
make: *** [main.o] Error 1
main.cc
Code:int size = 2; unsigned char* array[size]; array = makeArray(size); for (int i = 0; i < size; i++) { printf("%s\n", array[i]); } // end of for loop
functions.cc
Code:unsigned char* makeArray(int size) { unsigned char* array = new unsigned char[size]; // fill in the array array[0] = "1"; array[1] = "0"; // return array return array; } // end of makeArray