View Full Version: void int? declaring a function

C++ Learning Community > C++ Help > void int? declaring a function


Title: void int? declaring a function
Description: probaly easy


dr voodoo - June 24, 2003 11:24 AM (GMT)
Now I have seen functions beeing declared this way:
int functionname(argument name+type)
{
code
}
but I have also seen
void functionname(argument name+type)
{
code
}
and this also works
functionname(argument name+type)
{
code
}
I'm confused :blink: what does this optional int,void have to say?

ih8censorship - June 24, 2003 01:21 PM (GMT)
dunno bout the void but the int says that that function returns an interger i think thats why most programs haver return 0; at the end of int main but i could be wrong.

Shadow of the Moon - June 24, 2003 01:35 PM (GMT)
Yeah, void, int, double, char, etc. before a function declares its return type.
Void means it doesn't return a value. It's a good idea to put something there, even if it is void.




* Hosted for free by InvisionFree