answersLogoWhite

0


Best Answer

Function is a logically grouped piece of code allowing perform certain types of operations. Function can return value (int, double etc) or be void type - meaning they do not return value.

Functions allow to make code cleaner by moving out chunks of code of main body. For instance you want to write a function that finds area of rectangular.

#include <iostream>

using std cin;

using std cout;

using std endl;

using std get;

int main()

{

double sideA = 0.0;

cout << "Enter side a of rectagular: ";

cin >> sideA;

double sideB = 0.0;

cout << endl << "Enter side b of rectangular: ";

cin >> sideB;

//This part passes sides a and b to user defined function "Square"

cout << endl << "Area of rectangular is: " << Square(a, b);

cin.get();

return 0;

}

//definition of user defined function Square

double Square(double a, double b)

{

return (a * b);

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is function Explain the user define function with example?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the different user define data typesexplain with example?

what are the different user define data types explain with example


What is user define datatype and explain it?

Any datatype which the user creates in code, that isn't native to the language. A linked list can be an example of this


Differences between user define function and uild in?

The person who created them.For example, you don't have to write an 'sprintf'function, because you already have it in the standard libraries.


What is the way by which you can make the user defined the size of the arrays?

By using the library function #define A[] we can define the size of arrays


How to know whether the function is user define function or library function?

You don't have to know. Library functions are also written by somebody, aren't they?


What are user defined data types?

Actually user defined data type made by user like array,structure,union,pointer. the data type which is define by user or programer according to his need is called user define data type and also called the programer define data type........


What is the user defined function section in C language?

There are no 'sections' in C source, you can define functions anywhere, except inside another function or variable/type definition.


What can a function be defined as?

Definition: By function We Means In C which Perform Some Specific Task..e.g Print Scan etc. The function Should Inclosed of Parantheses. There Are two Types Of Function 1.User Define Function 2.Built in function


Why main is called user define function?

It simply means that main is not part of a pre-written library like printf or sleep.


What Difference between built-in function and user define function?

Built-in functions are functions that are provided for you by the standard includes. User-defined functions are those that you write yourself. Third-party functions are those that are written for you, but that are not provided by the standard includes.


What do you mean by GUI and Explain different GUI technology with help of example?

Graphical User Interface


Define process according to user interactionin operatin system?

4. Define process according to user interaction?