Functions in C as Functions in Maths

What are functions in C?

Earlier, for me, the function in C meant only  a group of statements that is executed when it is called from some point of the program. And I thought the function in C is different from the functions that I learnt in mathematics.

C language has functions that performs a particular task and returns a value. These functions contain a set of instructions that performs various operations.

Mathematically, a function is a relation between a set of inputs and a  value. It is a mapping from a domain to a co-domain.  We can compare the functions in C also to such mappings. Here the domain is formed by the arguments passed to the functions. Those are the values on which the function is going to operate.  The function performs a particular operation and then returns a value. That is the value to which the inputs are mapped. Thus for each value in the domain, there exists a return value.

This knowledge gives a wider understanding of what a function is and how it works apart from the normal definitions in the C language references.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s