I've recently switched from Java to learning C++, I'm a newbie to this language so I need your help :)
What's the difference?
void method(void) {
}
and
void method() {
}
Many thanks!
I've recently switched from Java to learning C++, I'm a newbie to this language so I need your help :)
What's the difference?
void method(void) {
}
and
void method() {
}
Many thanks!
In C++, there's no difference -- they both mean a function that takes zero arguments.
In C, ()
means a function that takes any number of arguments, while (void)
means a function that takes zero arguments.
None. There was a difference in C (void
means no parameters and nothing means an unknown number of parameters) but not in C++; they are the same.
C++ is the exact same, however in C it means a function that takes any # of arguments. It is really just a stylistic matter that is up to you.