03.revision Series-4 Basics of C++
03.revision Series-4 Basics of C++
Revision Series -4
Educator: Twinkle S. Panchal
Assistant Professor
Sutex Bank College of Computer
Applications and science
Previous Lecture Highlights
1. C ++ was developed by BJarne Stroustrup at AT & T Bell lab, USA in
early 1980s.
For Example:
To inline a function, place the keyword inline before the function name and
define the function before any calls are made to the function.
The compiler can ignore the inline keyword in case defined function is more
than a line.
The inline function syntax as follows:-
function body;
Example:
{ return(a*a*a); }
c=cube(3.0); d=cube(2.5);
Example for Inline Function
inline int Max(int x, int y) {
return 0; }
Advantages of Inline Function
1. It speeds up your program by avoiding function calling.
4) If a function return type is not void, and the return statement doesn’t
exist in function body.
The compiler looks at the prototype to see how many arguments a function
uses and alerts the program for possible default values.