954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

wats difference between return(0) and retrun()

plz can any one help me out???

supriya badam
Newbie Poster
8 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

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
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
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,826
Solved Threads: 601
 

Wat is a size of string in C++?does string ve specific size...?? like integer.. Float.. Char..?

supriya badam
Newbie Poster
8 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

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
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
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,826
Solved Threads: 601
 
  • "retrun" is misspelled; it should be "return".
  • "wats" is misspelled; it should be "What's the" or "What is the".
  • "plz" is misspelled; it should be "Please".
JeffGrigg
Posting Whiz in Training
218 posts since Aug 2011
Reputation Points: 192
Solved Threads: 28
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You