Ask your own question, for FREE!
Computer Science 13 Online
OpenStudy (anonymous):

Can someone explain the void function in c++?

OpenStudy (anonymous):

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. As simple as that.

OpenStudy (e.mccormick):

Generally you do not use `type function_name(void);` in c++, but that is popular in c. The main thing void is used rfor in c++ is the second thing siddhantk3m8 noted, making a function that returns nothing. Note: This just means trurn via the return statment. Pass by reference can still be used. The biggest mistake with void is using it on the main function. All of this has to do with standards. http://www.parashift.com/c%2B%2B-faq-lite/newbie.html#faq-29.3

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
21 hours ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
1 day ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!