User defined Function






" Function is defined as a group of statements that together perform a specific task. "



- Main() is a function, therefore every C++ program should have at least one function.

- Function is divided into 3 part 
         1 - function declaration
         2 - function definition
         3 - function call 

- A function declaration tells the compiler about a function's name, return type, and parameters.

- A function definition means body of the function.

- A function call is a part of main programs and it specified which function should be called.



Example -






There are four possible style to write a function in your program -


1- void function with no argument 
                   e.g-

2- void function  with argument 
                    e.g-
Note- Arguments in the function always assign from RIGHT to LEFT.

3- Non void function with no argument
                    eg-


4- Non void function with argument 
                    eg-

Note- Arguments in the function always assign from RIGHT to LEFT.




Please read ... For better Understanding

 Difference between a formal and an actual parameter And Call By Value & Call By Reference






By - Somesh Sah




Comments

Popular posts from this blog

Include Vs Import

Object Oriented Program (Paradigm)

Operators and Expressions