Just finished my first C course!! And have 2 little things i was wondering if someone could clarify.
1. Is a string defined as a nulled char array?
2. What's the difference for a main to be defined as "int main(void)" rather than "void main ()"?
Just finished my first C course!! And have 2 little things i was wondering if someone could clarify.
1. Is a string defined as a nulled char array?
2. What's the difference for a main to be defined as "int main(void)" rather than "void main ()"?
1) If you mean "is a string a character array terminated by \0" then the answer is yes.
2) Cprogramming.com FAQ > main() / void main() / int main() / int main(void) / int main(int argc, char *argv[])
1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
3. Get rid of conio.h and other antiquated DOS crap headers.
4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.
thanks that link was great