I was trying to return an array from child_prog() to main(). The code looks like this:
#include<stdio.h>
#include<stdlib.h>
int* child_prog(int some_input);
void main(void){
int C[10];
int some_input;
C = child_prog(some_input);
}
int* child_prog(int some_input){
static int out[10];
// ...
// ... some wizardry
return out;
}
Now the compiler generates an error saying that it can not assign to C (which is an int[] type) the value returned from child_prog (which is an int* type). Indeed, the program works fine when I make C an int* and malloc it 10 ints of memory. But I don't understand why the compiler can't assign to C (an array defined as C[10] and hence a pointer) the value returned from child_prog (an array defined as static int out[10] and hence again a pointer).