+ 1

What difference between [void func(void)] with the function [void func()] . Bath functions are the same parameter

9th Mar 2019, 12:46 AM
Farrukh Yuldoshev
Farrukh Yuldoshev - avatar
3 Réponses
+ 1
Actually, it depends on whether you're typing this in C or C++. In C++, both are semantically similar. In C, not specifying anything in the function parameter list would mean that the function takes an unspecified number of arguments, whereas placing "void" in the parameter list declares that the function takes no parameters. https://stackoverflow.com/questions/5929711/c-function-with-no-parameters-behavior
9th Mar 2019, 4:38 AM
Hatsy Rei
Hatsy Rei - avatar
0
No difference. function() and function (void) are the same and the compiler will not allocate stack for untyped parameter.
9th Mar 2019, 1:19 AM
Mauricio Martins
Mauricio Martins - avatar
0
Thank you.
9th Mar 2019, 2:10 AM
Farrukh Yuldoshev
Farrukh Yuldoshev - avatar