web analytics

What is recursion?

Recursion : Recursion is a special case where a function calls itself. A very simple example of recursion is presented below, main(){ printf(“This is an example of recursion.n”); main(); } When executed this program will produce an output which is something like this, This is an example of recursion. This is an example of recursion. This … Read more

What is nesting of functions?

Nesting of functions : In C, each function can contain one or more than one function in it. There is no limit as to how deeply functions can be nested. Consider the following example, function main(){ function01(); }function function01(){ function02(); }function function02(){ //do something more here. } In the above example, The main() function contains function01(), the function01() contains function02 and so on. This … Read more

What are parameters in functions?

Function Parameter: Function parameters are variables of a function that we can use to send data to the function. Parameters are declared as follows:function function_name(int var_a, float var_another){//do something here}Here in the above function var_a and var_another are two parameters of the function called function_name. When making a call to that function as followsfunction_name(5, 5.5);we are … Read more

How to declare a function in C or C Plus Plus?

Function declaration : The program or a function that called a function is referred to as the calling function or calling program. The calling program should declare any function that is to be used later in the program. This is known as the function declaration.  A function declaration consists of four parts. They are, Function type … Read more

Explain or Discuss function call.

Function call : In order to use functions user need to invoke it at a required place in the program. This is known as the function call. A function can be called by simply using the function name followed by a list of actual parameters, if any, enclosed in parentheses. Example :  int function mul(int x, … Read more

Explain or Describe function definition.

Function Definition:  The function definition is an independent program module that is specially written to implement to the requirements of the function. A function definition, also known as function implementation shall include the following elements Function name Function type List of parameters Local variable declarations Function statements A return statement All the six elements are … Read more

What are user defined functions? What are the elements of user defined functions?

elements-of-user-defined-functions

User defined functions

Functions are blocks of codes to perform specific tasks and return the result. However it is not mandatory for a function to return something. Also a function can perform more than a single task. User defined functions are basic building blocks of a program and can be found in the basic structure of C program.

Read more

What is multi-function program?

Multifunction program : A function is a self-contained block of code that performs a particular task. Once a function has been designed and packed, it can be treated as a ‘black box’ that takes some data from the main program and returns a value. Thus a program, which has been written using a number of functions, … Read more