by Vangelis Livadiotis
Arguments are very important and are a part of every program written in the industry. In the specific example shown in the applet below arguments are not really needed since the variables are "visible" to the procedure, meaning that the procedure could have used the variables directly without the use of arguments. Arguments are usually used in the case that the procedure is not in the same file as the main program and we have to give the variables to the procedure to use. This is a simple example and not a program to be used in real life. This should really be a function which gives an integer back, but it is a simple example to show how arguments work and the big difference if you have the word "var" in front of an argument.
Note that in other programming languages such as C and Java arguments are passed as var arguments by default.
The code used in the applet below is given here.
To operate this applet simply move along the steps. Every time a part of the program is colored red the textbox below will provide information about that piece of code and some images will appear on the right showing a graphical way of how the program works.
Note: When clicking one button after the other there is a delay of one click. You should click the other button twice to move forward, backward.
Home | Arrays | Arrays2 | Queues1 | Queues2 | Stacks | Arguments | Pointers |
Binary Search Tree
Copyright © June 2005 - Author Vangelis Livadiotis