What is the value that is stored in void()? Basically it is used before a function which doesnot return anything. But does simply void holds any value?
Asked
Active
Viewed 296 times
-3
-
4That's one of the best kept C++ secrets. The value is `42`. (this is a joke, in case it wasn't clear) :) – Luchian Grigore Oct 15 '14 at 14:47
-
plz someone reply a teacher asked me this – user3091132 Oct 15 '14 at 14:47
-
Answer 42 is a joke. Ignore it. – Dialecticus Oct 15 '14 at 14:48
-
@user3091132: Just FYI: [Answer to the Ultimate Question of Life, the Universe, and Everything (42)](http://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker%27s_Guide_to_the_Galaxy#Answer_to_the_Ultimate_Question_of_Life.2C_the_Universe.2C_and_Everything_.2842.29). It really was a joke. – Rudy Velthuis Oct 15 '14 at 15:02
2 Answers
1
The use of void for a return value means simply that there is nothing returned. So, there is no value, because there is just nothing at all.
David Heffernan
- 587,191
- 41
- 1,025
- 1,442