I need to do a simple thing, which I used to do many times in Java, but I\'m stuck in C (pure C, not C++). The situation looks like this:
int *a; void initA
You are assigning arr by-value inside initArray, so any change to the value of arr will be invisible to the outside world. You need to pass arr by pointer:
arr
initArray
void initArray(int** arr) { // perform null-check, etc. *arr = malloc(SIZE*sizeof(int)); } ... initArray(&a);