I was wondering if there is any difference (in terms of syntax and performance) between a string defined like
char str[200];
and
char *str;
str = calloc(200, sizeof(char));
Are there differences in terms of usage? (for ex, one is not compatible with strncpy
or something) And more importantly, are there differences in terms of performance?
EDIT: I understand that an array defined by char *
and calloc
can grow and shrink, but should I pick heap memory over stack memory or the other way around for any reason? That's what I was really trying to ask.