FUNCTION IN C++ PART-1

In this first part of 'Functions In C++' we will see the definition of a function and some of aspects and some parts of the function and some more.....

Definition Of Function:

Well functions are most easy to use in C++ only if you know how to use them. The most important way of getting some work done in C++ programs is to call a Function.Defining a function is the way you specify how an operation is to be done. A function cannot be called unless it has been previously declared.

Aspects Of Function:

  • The larger sized program can be divided into smaller ones.
  • The smaller programs can be written in the form of functions.
  • The process of dividing a large program into tiny and handy sub-programs and manipulating them independently is known as modular programming.

Advantages Of Function:

  • Reduction in program size.
  • Code duplication is avoided.
  • code reusability is provided.
  • Functions can be called repetitively.
  • A set of functions can be used to form libraries. Support of Modular  programming.

 

So these are the basic things you need to know about functions and with the following image you will be able to know the difference between functions in C and C++:

main_in_C_and_C

and I think you are clear with the difference with a tabled format....

Parts Of Function:

  • Function prototype declaration
  • Definition of a function
  • Function call
  • Actual and formal arguments
  • The return statement

Function Prototype:


A function prototype declaration consists of the function return type, name and arguments list.
The function prototype declaration statement is always terminated with semi colon.

 

thats all with Part-1 see you soon in Part-2 of Functions In C++


Like it on Facebook, Tweet it or share this article on other bookmarking websites.

No comments