Void vs Int Functions
问题 What would be the different between void and int functions? When do i use which? Would void be used when just printing out a message or a variable value? like cout << value; Or would it just be text? And is int used when you actually do calculations within it? 回答1: void is used when you are not required to return anything from the function to the caller of the function. for eg. void no_return_fn() { cout<< "This function will not return anything" << endl; return; // returns nothing or void }