8 a]Discuss the various ways of passing parameter to the functions.
![](https://i0.wp.com/bgmileaks.com/wp-content/uploads/2022/04/image-123.png?w=1290&ssl=1)
- Void Functions without parameters – No arguments and no return values
➢ When a function has no arguments, it does not receive any data from the calling function.
➢ Similarly, when it does not return a value, the calling function does not receive any data from the called function.
![](https://i0.wp.com/bgmileaks.com/wp-content/uploads/2022/04/image-124.png?resize=589%2C297&ssl=1)
No data communication between functions
![](https://i0.wp.com/bgmileaks.com/wp-content/uploads/2022/04/image-126.png?resize=574%2C262&ssl=1)
2. Void Functions with parameters – Arguments but no return values
➢ The calling function accepts the input, checks its validity and pass it on to the called function.
➢ The called function does not return any values back to calling function.
The actual and formal arguments should match in number, type and order as shown in above Figure
![](https://i0.wp.com/bgmileaks.com/wp-content/uploads/2022/04/image-127.png?w=1290&ssl=1)
One way data communication
![](https://i0.wp.com/bgmileaks.com/wp-content/uploads/2022/04/image-128.png?resize=615%2C316&ssl=1)
Arguments matching between the function call and the called funtion
![](https://i0.wp.com/bgmileaks.com/wp-content/uploads/2022/04/image-129.png?resize=587%2C255&ssl=1)
In this example a photocopy of value stored in ‘num’ (i.e. 5) is made in ‘no’ and finally displayed on screen
3. Functions with parameters and return values – Arguments with return values
➢ The calling function sends the data to called function and also accepts the return values from called function.
➢ Actual Parameters: When a function is called, the values that are passed in the call are called actual parameters.
➢ Formal Parameters: The values which are received by the function, and are assigned to formal parameters.
![](https://i0.wp.com/bgmileaks.com/wp-content/uploads/2022/04/image-130.png?resize=483%2C290&ssl=1)
two way data communication between functions
![](https://i0.wp.com/bgmileaks.com/wp-content/uploads/2022/04/image-131.png?resize=567%2C271&ssl=1)
4 .Functions without parameters and with return values – No arguments but returns values
➢ The calling function does not send any data to called function and but, accepts the return values from called function.
➢ Global Variables: These are declared outside any function, and they can be accessed on any function in the program.
➢ Local Variables: These are declared inside a function, and can be used only inside that function.
![](https://i0.wp.com/bgmileaks.com/wp-content/uploads/2022/04/image-132.png?resize=607%2C369&ssl=1)