We al know that our computers use computer programs to operate with, but how many of us know that a computer uses also subprograms, which are the basis of a program and give the general behaviour of a main program?
“Sub” is the part identified by the name of a subprogram, which may be activated on demand by using this name. Some of the subprograms use algorithms that contain the same sequence of executable operations for the same data or different data. Instead of placing the instructions in the same place, or the same group of instructions, the instructions of the sub-group are prefered by some programmers because they will appear in the program only once and they will be activated everytime the user wants that.
There are programs that solve a part of the sub-problems that break down into complex issues. The Pascal language, for example, uses two types of subprograms: procedures and functions. The difference between these two is the number of calculated values and returned values, on the calling of the main program. The procedures calculate several values or none, and return a single value for the function associated with the name. Both procedures and functions may be standard (built in the system unit) and non-standard (user defined). Non-standard procedures and functions must be declared before being called by the program.
A sub-statement includes: a header which specifies the subprogram interface what is its environment, and a
sub-block that describes its internal functioning.
The field of vision means that the program is valid or the definition of an identifier is correct. All identifiers defined or declared in a block are known and are called local variables. If the block includes other blocks included in the identifiers (local variables thereof) which are not defined or renamed, then these blocks will be called global variables. If a variable, declared in a block when the block was redefining its variables, was assigned, it will then be generated in a restatement.
A procedure calculates several values of the accessible subprogram by calling the program or performs certain operations without having to calculate any value. The calculated values are accessible though the fact that the program calles actually the subprogram’s output parameters. They can depend on certain values received from the calling program, the sub-values representing the input parameters. Formal parameters are sub-symbolic variables. They are declared in the subprogram header and are known only inside the subprogram. Actual parameters are variables that actually work when activating the subprogram.
The declaring procedure is done using: the name of the procedure, the list with parameters, which are separated by ; . For each parameter, you have to specify the name and type of the parameter. The calling procedure is presented next. To run a procedure that was called by a program is not easy, if you are not a programmer. The name of the procedure gives concrete values for the parameters, which are separated by a comma. For example: reading procedure (n: integer k: char); begin … end; .
When calling a procedure, the call mode is temporarily abandoned in order to run the procedure. During the execution procedure, formal parameters are replaced in the whole body of the procedure with actual parameters (actual values). After the execution procedure, the module returns to the line immediately following the caller who made the call. Formal parameters and actual parameters do not necessarily have the same name, but there must be a line of numbers, type and order. More about computer programs and subprograms I will write in some other articles. Right now, I will focus more on Web applications. Stay connected.11