I am currently writing a simple function in C, which is structured in this way:
int *fillArray(int dim)
{
static int ar[dim];
// fill the array ar in some way
return ar;
}
It is usually said that using the static
keyword in local function is discouraged. I was wondering if it was better to do in the classic way:
void fillArray(int *ar, int dim)
{
// fill the array ar in some way
}
As a further fact, consider that I later want to wrap the function in Python code, and the Python function should not take parameters.