This is a discussion on void funct_name(void) and void funct_name(). Are they same. within the C Programming forums, part of the General Programming Boards category; void funct_name(void) and void funct_name()...
They are not the same. The first one takes NO arguments while the second one may take an unknown number of arguments. This is mostly a leftover from early C (C89).
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.
It depends where those lines fall. Function prototypes are different than function definitions on how they handle empty parenthesis. A function prototype with an empty parameter list means it takes any number of arguments. A function definition with an empty parameter list means is the same as void.
When in doubt, be specific.
Last edited by quzah; 06-11-2011 at 03:19 PM.
Hope is the first step on the road to disappointment.