From a43d6c6dafe50c066e8c739c7ff5b15a661e493f Mon Sep 17 00:00:00 2001 From: Nischay Hegde Date: Thu, 2 May 2019 03:33:18 +0530 Subject: [PATCH] Fixed syntax error. (#27164) * Fixed syntax error. Fixed a syntax error in line 55. Also corrected the indentation. * Update index.md --- guide/english/cplusplus/inline-functions/index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guide/english/cplusplus/inline-functions/index.md b/guide/english/cplusplus/inline-functions/index.md index 4a9d92d73d..da9a43443a 100644 --- a/guide/english/cplusplus/inline-functions/index.md +++ b/guide/english/cplusplus/inline-functions/index.md @@ -6,7 +6,7 @@ title: Inline Functions in C++ When the program executes the function call instruction, the CPU stores the memory address of the instruction following the function call, copies the arguments of the function on the stack, and finally transfers control to the specified function. The CPU then executes the function code, stores the function return value in a predefined memory location/register and returns control to the calling function. This can become overhead if the execution time of function is less than the switching time from the caller function to called function (callee). For functions that are large and/or perform complex tasks, the overhead of the function call is usually insignificant compared to the amount of time the function takes to run. However, for small, commonly-used functions, the time needed to make the function call is often more than the time needed to actually execute the function’s code. This overhead occurs for small functions because execution time of small function is less than the switching time. -C++ provides an inline functions to reduce the function call overhead for small functions. An inline function substitutes the code of the function where the call is being made (inline) instead of passing to the function. This substitution is performed by the C++ compiler at compile time. +C++ provides inline functions to reduce the function call overhead for small functions. An inline function substitutes the code of the function where the call is being made (inline) instead of passing to the function. This substitution is performed by the C++ compiler at compile time. The syntax for defining the function inline is: @@ -52,7 +52,7 @@ int main(){ MathOperation obj; - cout << "Addition is :" << obj.add(34,12) << <"\n"; + cout << "Addition is :" << obj.add(34,12) << "\n"; cout << "Division is :" << obj.div(12,3.4) << "\n"; return 0; @@ -124,8 +124,8 @@ inline void operation :: product() inline void operation ::division() { - div=a/b; - cout<<"Division of two numbers: "<