Is it bad practice (and programming) to use plain arrays in functions not unlike this?
I've done that before and have gotten really severe out of bounds (when the 2nd or 3rd call of the array came around), like -107839 or something for int arrays, -84 for char arrays, etc. I solved the problem like this:Code:char function(char *string) { char a[4]; /* Is this bad? */ /* etc... */ return a[whatever]; }
But why doesn't my declaration of my char array 'a' work?Code:/* Instead of this: */ char a[4]; /* I used: */ char *a = calloc(4, sizeof(char));