> will it be deallocated anyway since it is only in scope within the function?
The only way you can be sure that the memory is released is to do it yourself with free. Many systems will release allocated memory when the program terminates, but that's not a requirement.
> I seem to be getting a...
> what's the keyword auto for?
IIRC, auto was only used in a compiler symbol table. Other than that the only other possible purpose for auto is to format your declarations so that they match up vertically in the presence of other qualifiers:
const int a;
auto long b;
static char c...
> do I need to typecast the received buffer back into the original structure type?
Yes. Type punning is tricky business, especially with structures and potential padding. As such, it's recommended that you typecast using pointers to unsigned char rather than char to avoid trap representations...
Place a declaration in the header file of your choice that's to be included in each of the multiple files, then add a new file for the definition:
/* foo.h */
extern int global;
/* foo.c */
int global = 0;
Include foo.h everywhere you need global, compile and link foo.c along with your other...
The simple way is
#define N 50
#define MAX_LENGTH 31
char names[N][MAX_LENGTH];
This gives you an array of 50 arrays of 30 characters. But if the maximum length of each name is 30 and the expected length is considerably less, you might be better off with dynamic allocation:
#define N 50...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.