Your return type is char** , and you assign it to char**[] , which is incompatible.
In addition, you must publish the actual code with which you are having problems, the code that you published does not compile and does not make much sense.
To fix your code, the function must return char **[NUMBER] . Also note that you are returning the char* return value instead of the char** that you declared (or char **[NUMBER] that it should be, but actually is).
Oh, and returning a pointer to a local variable, as in your case, is the perfect recipe for crashes and undefined behavior.
What do you probably mean:
char *array[NUMBER]; int ret = build_array(array, NUMBER);
and in the imported file
int build_array(char **arr, int size) { // check that the size is large enough, and that the // arr pointer is not null, use the return value to // signal errors arr[0] = "A"; arr[1] = "B"; return 0; // asume 0 is OK, use enums or defines for that }
source share