No, some functions have no return. These functions are declared as having a void type, to indicate that they don't.
void foo(int bar)
cout << bar << endl;
As for the value of the return and how it is used, that depends greatly on the function in question. For example, the math function pow() returns a double, which is the result of the function's computation (it computes the value of the first argument raised to the second argument). The old C-style input function scanf() returns the number of characters read in. Th character function toupper() returns the upper-case form of it's input, if the character is a letter. It all depends on the function and what it is meant to do.
If it returns 0 then when it will return other than 0?
i'd be happy if you ask this question in connection with main function.
anyways , its nothing speical to return different values , you just need to use that value with return statement.See below :
Here the function Factorial_Three returns the value 6(which is what you want(i.e. other than 0).And it return the value from where the function is called.Therefore it prints 6.
And whether function have any default return value?
for main function , its int. it means if your don't specify any return type then it will be considered as int by default. but it's not good practice , therefore always use int main() instead of main().
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.