click on this link......

LinkGrand.com

Sunday 31 March 2013

user defined functions in C

User Defined Functions
    A user defined function in C can be created to perform specific tasks.  It consists of the following steps:
1) Specifying a function prototype
    Specify the signature of the function, ie.
    - the return type
    - the name
    - the argument types of the function
2) Specify the function definition
    Specify the steps to be performed by the function.

Both the function prototype and definition must be given outside "main" function.
3) Call the function
    The function is called or invoked from within the main() function.

There are mainly 2 types of functions
1) A function which does not return a value, i.e., return type is "void".
2) A function which returns a value.

The arguments passed from main are called as actual arguments and the arguments of the function, where they are collected are called as formal arguments.

No comments:

Post a Comment