Types Of Functions
}A function with no parameter and no return value
}A function with parameter and no return value
}A function with parameter and return value
1.A function with no parameter and no return value
I. There is no data transfer between calling and called function
II. The function is only executed and nothing is obtained
III. Such functions may be used to print some messages, draw
stars etc.
2.A function with parameter and no return value
3.A function with parameter and return value
3.A function with parameter and return value
4.A function without parameter and return value
INLINE FUNCTION
• One of the objectives of using functions is to save some memory space, which becomes appreciable when a function is likely to be called many times.
• Every time a function is called, it takes a lot of extra time in executing a series of instructions.
• To eliminate the cost of calls to small functions, C++ proposes inline function.
• An inline function is a function that expanded in line when it is invoked.
• The compiler replaces the function call with a corresponding function code.
• inline function header
{
function body
}
{
function body
}
• Prefix the keyword inline to the function definition.
0 Comments