Hi :)
Please have a look on this page:
https://docs.google....uthkey=CIyjmI8C
My query is about the diagram. There are two diagram sections: Function and Calling Program. Function contains void func1(), and Calling Program contains func1(), func1(), func1().
Is void func1() a major function which makes calls to func1()?
What does the heading "Calling Program" mean?
Are all the three functions func1() same? If they are, then what's the need for listing func1() three times?
Any other advice. Please help me. Thanks
10 replies to this topic
#1
Posted 03 May 2011 - 12:27 PM
I'm an outright beginner, learning C++. Using Win XP Pro and Code::Blocks. Be nice to me, please.:)
|
|
|
#2
Posted 03 May 2011 - 02:58 PM
void func1() is the function.
The left diagram is the Calling Function.
The three instances of func1() in the Calling Function are the Function calls.
The left diagram is the Calling Function.
The three instances of func1() in the Calling Function are the Function calls.
#3
Posted 03 May 2011 - 03:21 PM
WingedPanther said:
void func1() is the function.
The left diagram is the Calling Function.
The three instances of func1() in the Calling Function are the Function calls.
The left diagram is the Calling Function.
The three instances of func1() in the Calling Function are the Function calls.
Thank you, WingedPanther.
Is "Calling Function" the body/code of the function being called? If it is, then why is it called "Calling Function"? Shouldn't it be "Called" Function?
Please guide me. Thanks.
I'm an outright beginner, learning C++. Using Win XP Pro and Code::Blocks. Be nice to me, please.:)
#4
Posted 03 May 2011 - 04:34 PM
I'm pretty sure it is called the "calling" function because it calls that instance of func1(). Or "calling" is a verb in this case. I don't really understand the diagram that much though.
Latinamne loqueris?
#5
Posted 03 May 2011 - 04:51 PM
the function on the left calls func1. It is the function that is calling func1.
#6
Posted 03 May 2011 - 05:08 PM
I think I get it now. It appears that the "func1()"s in the "Calling Code" are function declarations, and the diagram shows that the code in there calls that function.
Latinamne loqueris?
#7
Posted 03 May 2011 - 08:30 PM
WingedPanther said:
the function on the left calls func1. It is the function that is calling func1.
Thanks, WingedPanther. Isn't void func1() the one which is calling func1()? Is there any possibility that the Calling Program a some kind of header file, as I believe mebob points out? Please let me know. Thanks.
mebob said:
I think I get it now. It appears that the "func1()"s in the "Calling Code" are function declarations, and the diagram shows that the code in there calls that function.
Thanks, mebob.
I'm an outright beginner, learning C++. Using Win XP Pro and Code::Blocks. Be nice to me, please.:)
#8
Posted 04 May 2011 - 04:26 AM
void func1() is the DEFINITION of the function.
#9
Posted 04 May 2011 - 06:36 AM
Oops lol I noticed my mistake, I was tired last night. In the calling code, it has "func1();" statements; that is what is calling the function. On the right, it shows that function declaration, "void func1()". Sorry about the confusion.
Latinamne loqueris?
#10
Posted 04 May 2011 - 12:58 PM
I would like to add that the diagram contains arrows showing transfer of control i.e.
There is a calling program, which calls func1, so program control jumps from left (calling program) to right into the called function (void func1() which is function definition). It executes func1 line by line and once completed, control is transferred BACK TO CALLING PROGRAM and proceed with the next step.
This is repeated throughout the diagram and the primary intention is to develop the notion of sequence of execution of instructions in a program during function calls.
Also note that this applies to single threaded program. Otherwise the arrows could be drastically different assuming we create a new thread with every call.
There is a calling program, which calls func1, so program control jumps from left (calling program) to right into the called function (void func1() which is function definition). It executes func1 line by line and once completed, control is transferred BACK TO CALLING PROGRAM and proceed with the next step.
This is repeated throughout the diagram and the primary intention is to develop the notion of sequence of execution of instructions in a program during function calls.
Also note that this applies to single threaded program. Otherwise the arrows could be drastically different assuming we create a new thread with every call.
#11
Posted 05 May 2011 - 10:37 AM
Thanks a lot, everyone. I understand it now.
Best regards
Jackson
Best regards
Jackson
I'm an outright beginner, learning C++. Using Win XP Pro and Code::Blocks. Be nice to me, please.:)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









