A function cannot return an array, only a pointer to an array. So I tried doing this:
int *arr = {-1, -1};
Is that valid syntax? I got a warning from the compiler for that. If not, is there a better way of setting a pointer variable to an array without looping?
void* f(){ int size = sizeof(int)*2; return memcopy(malloc(size), (int []){2, 4};, size); }int *ptr = &arr[0];or evenint *ptr = arr;.