Hi There,
There was a time in which I used C daily, but that was like 10 years ago. Now Im back, and there is something that probably didn't change in this 10 years, but I cant really remember how it works. I searched in the forum but didn't find conclusive answer.
Question is:
When I first learnt programming C in borland, I'd been told that arrays can only be defined with constants:
or of course:
Code:
#define N 10
int a[N];
otherwise, you you had no other choise but using dynamic memory:
Code:
a = malloc(sizeof(int)*10);
now I see that is totally possible to do:
Code:
int n=10;
int a[n];
My question is: whats the difference -if any- between these two ways? Are both allocating memory in the same place?
Thanks in advance