r/ProgrammerHumor • • Feb 03 '22

Meme Well Fuck

Post image
27k Upvotes

993 comments sorted by

View all comments

Show parent comment

2

u/visvis Feb 03 '22

In plain C, an empty parameter list doesn't mean that the function has no parameters, but rather that the list of parameters may still be specified later. To correctly declare a function without any parameters, you specify the parameter list as void.

Note that this syntax is also allowed in C++ for backward compatibility, but meaningless because the default is an empty parameter list there (declaring the parameters later doesn't work with parameter-based function overloading).

2

u/[deleted] Feb 03 '22

Huh, that's pretty neat. I never learned C, just its derivatives so I had no idea something like that existed.