Saturday 4 December 2010

different sub part of the syntax




return_type  function_name(parameters)
{
  statements;
  statements;
  return (value); //optional
}

Function Heading:

1. in the above syntax, first line is called function heading
2. function heading should be identical to function prototype with the exception of semicolon
 arguments(formal parameters) are to be specify here.



return_type:

1. return_type is type of value is returned by function
2. return_type may be void if the function is not returning any value

function_name:
1. it is any unique identifier (u can give any name for the function name)

parameters:

1. comma seperated list of types and names of parameters
2. parameters takes the values to the function on which function is going to operate
3. parameter field is optional
4. if no parameter is passed , then no need to write this field

return value: or Return statement

1. it is value return by the function upon termination
2. function will not return a value if the function is void.
more expalnation about the  Return statement

 Functions

No comments:

Post a Comment