FUNCTION IN C++

Maha



Function in c++       

  • The functions play an important role in C program development. Dividing a program into functions is one of the major principles of top-down , structured programming.
  •  A large program can be split into smaller sub-programs (blocks) called as functions where each sub-program can perform some specific functionality.
  • Function can reduce the size and complexity of a program, makes it easier to understand ,test, and check for errors.
  • The functions which are available by default are known as "Built-in" functions and user can create their own functions known as "User-defined" functions.
  • A function can accept parameters, which are pieces of data.

Creating A Function

         Create a Function C++ offers a few predefined functions, like main(), which are used to run code. However, you can also develop your own functions to carry out particular tasks.

Syntax

void myFunction() 
{
  // code to be executed
}
Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send