Void | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Void

what us void ?

14th Oct 2016, 2:55 AM
Aman Khan
Aman Khan - avatar
9 Answers
+ 5
Void as a return value means that the function doesn't return anything. For example: void printn(int n) { cout << n << endl; } When void is in the parameter field, it means that the function doesn't take any parameter. For example: int getAnswer(void) { return 42; }
14th Oct 2016, 11:03 AM
Zen
Zen - avatar
+ 2
no return value
14th Oct 2016, 6:27 AM
shivani
shivani - avatar
+ 2
void print() { cout<<"Hello world"; } This function just prints the text on the screen, it returns nothing. That's when you use void, when you don't need to return anything.
14th Oct 2016, 12:43 PM
Suiko
Suiko - avatar
+ 2
What does the statement "return nothing means " .
25th Oct 2016, 7:39 AM
Akshay Kumar Tak
Akshay Kumar Tak - avatar
+ 1
it means that the function it is attached to will not return anything. (such as an int or double)
14th Oct 2016, 6:17 AM
Justin Zeh
Justin Zeh - avatar
0
void defines a function initialization within class
14th Oct 2016, 4:49 AM
Thai-Sang Trinh Tran
Thai-Sang Trinh Tran - avatar
0
Freer útfc btytvt5t tvffft6tyvy
6th Oct 2020, 4:33 AM
Roshan Dhungana
Roshan Dhungana - avatar
- 1
no return value
22nd Dec 2016, 3:05 PM
shivani
shivani - avatar
- 2
it is used to initialise the body of of program.
14th Oct 2016, 11:04 AM
Rasheed Khan
Rasheed Khan - avatar