Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I know I can do it, and one of my previous teachers (the only one who actually taught me something) always told me to avoid it, since it leads to bad programming habits (like returning in the middle of the function)
-
Basically it means "nothing" or "no type"
There are 3 basic ways that void is used:
Function argument: int myFunc(void) -- the function takes nothing.
Function return value: void myFunc(int) -- the function returns nothing
Generic data pointer: void* data -- 'data' is a pointer to data of unknown type, and cannot be dereferenced
Note: the void in a function argument is optional in C++, so int myFunc() is exactly the same as int myFunc(void), and it is left out completely in C#. It is always required for a return value.
EDIT: SO to the rescue. -
@rootshell
I know what void means, I was talking about the empty return at the end of the function 😅 -
It's standard, but not necessary. It marks the end of a function much like
// End of dick sucking function
Does -
@SimplyAero Well that is rather pointless yeah since it shouldn't return anything.
Related Rants
So, my teacher said that in c standard you have to put a return at the end of void functions, after a lot (and I mean A LOT) of research I've found nothing, am I missing something or is the person who doesn't respect any standard inventing that thing?
question
standard
c