Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
What do you mean with return to an area? The return command is used to return a value from a fuction that was called. Or just to end the processing of a function. Always to return a value, unless in a function, void was specified.
Could you clarify your question a little?
Cheers,
Dark_KartugWar sucks, but the sound is good and WE are the DJ's

This question has me thinking that you're a CS major newbie...
Anyhow, a short tutorial...
int area_function()
{
// Pre: none.
// Post: returns an INTEGER data type value.
int area = 5000;
return area;
}double area_function()
{
// Pre: none.
// Post: return a DOUBLE data type value.
double area = 5000.23;
return area;
}void area_function()
{
// Pre: none.
// Post: prints the area.
// void functions DO NOT return a value.
double area = 5.46;
cout << "Area is: " << area << endl;
}In brief, if you have an integer area function, you have to return an integer value. If you have a double area function, you have to return a double value (maybe the compiler will let you get away with returning an integer value, but it seems as if you're only a beginner, so don't worry about this implication for now). Void type functions do not return a value.
Big hint:
int main()
{
return 0;
}What is main()? It's an integer type function. What does it return? An integer value, 0. Does that make sense? Let us know if this has clarified some things for you.
- Rolos

In you function
double area_function()
you "return" a local varible "area". Can you make sure the value of "area" will be returned?Is that means function copy the "area" to the return address first, then release the memory in stack?
Could you explain more about the detail when "return" happens
Thanks
Bing

![]() |
Looking For CamStudio Cod...
|
The error that haunts me....
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |