+ 2

functions in c

whats the diff between void add( ) and void add(void)

21st Mar 2019, 6:38 PM
Shikher Jaitly
Shikher Jaitly - avatar
2 odpowiedzi
+ 2
They are the same; however if you use void add() as a function declaration, the function can take parameters, so the actual function definition might look like this: void add(int *a, int *b) { (...) } whereas if you use void add(void) as a function declaration, the function can't take parameters and if the function definition includes parameters, the code won't compile
21st Mar 2019, 6:51 PM
Anna
Anna - avatar