question - linux - gcc - c standards
I have just started learning C.
I use Linux with gcc 4.2.3 (I can upgrade the version, no problem)
my problem is with C standards, here is what I know:
there are currently two standards of C implemented c89 and gnu89, and two not yet fully implemented c99 and gnu99
gnu89 is the default now, gnu99 will be the default in the future.
which standard should I use (I guess it's gnu89)? and what is the standard in which most apps are coded in, for example the linux kernel is coded in which one?
I want my code to be compatible at least under all Linux distros, but I would also like if it compiles under other operating systems too.
also if someone will recommend a standard, what book should I use as a reference for that standard ("C complete reference" is good for C89 and C99, but what about the GNU extensions in gnu89/99 ?)
Thanks in advance.
Good C programming books!
If you're a C beginner, I think you should buy C Primer Plus Fifth Edition by Stephan Prata, and after you finish reading that one, you can also buy The C Programming Language Second Edition by Kernighan and Ritchie. I think the two books mentioned are really good for learning and mastering C. Well, mastering actually comes with a lot of practice, like any other thing. I hope you'll enjoy reading them, if you are going to buy the two books I recommended. Good luck, and if you're willing to have a study partner, I'm also studying C myself, etc. Goodbye for now, and I will talk to you soon.
extern should be the better option
should not we use
extern char * strcasestr(const char *, const char *);
rather than using
char * strcasestr (const char *haystack, const char *needle);
Thanks and Regards,