why void functions cannot contain return type?

Recommended Answers

All 2 Replies

void functions do have a return type, they return void. In some languages, you can say "return void" others you can't.

Consider void as meaning "nothing", so a function that returns void is returning "nothing". IE, there is no there there... :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.