Home » » Calling Functions

Calling Functions

Written By Unknown on Minggu, 22 Januari 2012 | 03.57

Lab RPL .
In order for a function to be used in a program, it must be called. To do this, the name of the functio and any parameters you are passing to it must be typed out EXACTLY as how you declared it. The below example shows how to call as well as declare function.
Example 1:
Void example .

Below is a program that will show an example of a void function and how is called .
#include <iostream.h>
void printMessage( )
{
cout<<"Hallo and Welcome ! "<<endl;
]
int main ( )
{
  printMessage () ;
return 0 ;
}
As you will observe , when the main function is run , the printMessage () function is called and prints out the message . Remember the rule of void functions : they do not return a value.



0 komentar:

Posting Komentar