If I'm using function Foo()
a lot of times, and Foo()
uses a temporary array, which of the two is more efficient:
1)
void Foo()
{
int arr[BIG_NUM];
...
}
OR:
2)
void Foo(int n)
{
int* arr;
...
arr = (int*)malloc(n*sizeof(int));
...
free(arr);
}