return() returns void (returns control back to the caller) , while return 0 returns a value, the integer 0....
For example, a function to calculate after-tax-pay might take be called by another function. e.g. getEmployeeInfo() may supply our calculatePay() method with the paramaters payrate (int), and taxband (char), do some processing, and return a figure represnting the after-tax-pay. getEmployeeInfo() is then free to do something with this result i.e. print it to the screen.
In the case of main() returning anything, returns control to the OS. The number can be used to indicate success or failure. E.g a daemon returning on a sever may return a value of -1 to the OS to indicate that it had encountered an error, this could then be noted, and recorded to a log.
jbennet
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,826
Solved Threads: 601
Plus, this doesnt belong here.Will move it to C++/Java/etc... if you tell me which is correct.
jbennet
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,826
Solved Threads: 601
It depends, there are two types of string, a C-style-string (char*) and a c C++ (STL) std:string
A C string is an array of characters sequence terminated with a NULL character ('\0').
C++'s std::string class fixes many of the problems that C-style strings have and can be constructed from a C-style string, and a C-style string can also be obtained from it using *.c_str()
jbennet
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,826
Solved Threads: 601
i think you getting mistakes somewhere..
return(0) is not existing...
plz chk
What on earth are you talking about? And please stop using "leet speak" like "plz chk" as it makes your (already hard enough to understand) replies unintelligible
jbennet
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,826
Solved Threads: 601