{"id":25672,"date":"2021-04-12T05:31:00","date_gmt":"2021-04-12T00:01:00","guid":{"rendered":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/"},"modified":"2024-04-30T16:59:46","modified_gmt":"2024-04-30T11:29:46","slug":"inline-functions-in-cpp","status":"publish","type":"post","link":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/","title":{"rendered":"Inline Functions in C++ | What is an Inline Functions in C++"},"content":{"rendered":"\n<p>Out of several exciting concepts of C++, the inline functions can prove to be pretty useful when it comes to the performance of a program. Before making a function inline, it is quite essential to have the know-how and know-what of the inline functions. Without any further ado, let\u2019s jump straight into our topic!<\/p>\n\n\n\n    <div class=\"courses-cta-container\">\n        <div class=\"courses-cta-card\">\n            <div class=\"courses-cta-header\">\n                <div class=\"courses-learn-icon\"><\/div>\n                <span class=\"courses-learn-text\">Academy Pro<\/span>\n            <\/div>\n            <p class=\"courses-cta-title\">\n                <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/learn-c-programming-for-beginners-to-advanced\" class=\"courses-cta-title-link\">C++ Programming Course<\/a>\n            <\/p>\n            <p class=\"courses-cta-description\">Master key C++ programming concepts like variables, functions, OOP, and control structures. Build real-world projects such as a banking system and grade management tool.<\/p>\n            <div class=\"courses-cta-stats\">\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-user-icon\"><\/div>\n                    <span>Beginner to Advanced Level<\/span>\n                <\/div>\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-star-icon\"><\/div>\n                    <span>8.1 hrs<\/span>\n                <\/div>\n            <\/div>\n            <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/learn-c-programming-for-beginners-to-advanced\" class=\"courses-cta-button\">\n                Start Free Trial\n                <div class=\"courses-arrow-icon\"><\/div>\n            <\/a>\n        <\/div>\n    <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"inline-function-in-c\"><strong>Inline Function in C++<\/strong><\/h2>\n\n\n\n<p>An inline function in C++ is an optimisation feature that reduces the execution time of a program, just as we have <strong>macros<\/strong> in C. This concept of inline functions is used while handling Classes in C++. It is used otherwise as well, though. Whenever such a function is encountered, the compiler replaces it with a copy of that function\u2019s code (function definition). In other words, one may say that such a function is expanded in-line, hence named as an <strong>inline function<\/strong>.<\/p>\n\n\n\n<p>Inline functions are commonly used when the function definitions are small, and the functions are called several times in a program. Using inline functions saves time to transfer the control of the program from the calling function to the definition of the called function.&nbsp;<\/p>\n\n\n\n<p>However, inlining a function is just a request or suggestion to the compiler, not any mandatory command. It depends on the compiler whether to accept or decline this suggestion of inlining a particular function. The compiler is most likely to not consider the inlining of a function under certain circumstances that are mentioned here as follows-<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>When a function with a return statement is not returning any value and marked as inline, the compiler does not respond to the programmer\u2019s request of making it an inline function.<\/li>\n\n\n\n<li>When a programmer tries to inline a function containing a loop (for, while, or do-while), the compiler refuses the inline suggestion.<\/li>\n\n\n\n<li>When a function is recursive, it cannot be inlined.<\/li>\n\n\n\n<li>A function containing static variables cannot be made an inline function.\u00a0<\/li>\n\n\n\n<li>The compiler declines the request of inlining a function if it contains any switch or go-to statements.<\/li>\n<\/ul>\n\n\n\n<p>The syntax for defining an inline function has been shown below:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>inline return-type function-name(parameters){&nbsp;&nbsp;&nbsp;&nbsp;\/\/ function code}&nbsp;&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"example-of-an-inline-function\"><strong>Example of an Inline Function<\/strong><\/h4>\n\n\n\n<p>In order to make a function inline in C++, the keyword \u201c<strong>inline<\/strong>\u201d is used. Here is an example of C++ code explaining the implementation of an inline function:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#include&amp;lt;iostream&gt;\nusing namespace std;\ninline int add(int a, int b) \/\/Inline function definition\n{\nreturn a+b;\n}\n\nint main()\n{\ncout&amp;lt;&amp;lt;&quot;The addition of 562 and 451 gives the value:&quot;&amp;lt;&amp;lt;add(562,451)&amp;lt;&amp;lt;&quot;n&quot;; \/\/Inline function call\nreturn 0;\n} \n\/\/Output: The addition of 562 and 451 gives the value:1013\n\n\n<\/pre><\/div>\n\n\n<p>Here, the inline function add(int a, int b) has been defined before the main() function and later been called inside the main () function. When the add function is called, the code of the add function definition is placed there, i.e. inlined at the time of compilation. Henceforth, it saves from the overhead of function calls and returns. The working of the inline function add(a,b) has been illustrated below:&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>#include &lt;iostream&gt;&nbsp;<\/strong><br><strong>using namespace std;&nbsp;<\/strong><br><strong>inline int add(int a, int b)&nbsp;<\/strong><br><strong>{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/strong>                                             <br><strong>return a+b<\/strong>:<br><strong>}&nbsp;<\/strong><br><strong>int main()&nbsp;<\/strong><br><strong>{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/strong><br><strong>cout &lt;&lt; \"The addition of 562 and 451 gives the value: \"&lt;&lt; add(562,451) &lt;&lt; \"n\";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/strong><br><strong>return 0;&nbsp;<\/strong><br><strong>}&nbsp;<\/strong><\/td><td><br><br><br><br><strong>COMPILATION<\/strong><img decoding=\"async\" width=\"115\" height=\"16\" src=\"https:\/\/docs.google.com\/drawings\/u\/8\/d\/sSyJ7dI5vd2XKVum7dvd-ng\/image?w=115&amp;h=16&amp;rev=1&amp;ac=1&amp;parent=1WxJEkh8lekmaWmSPKm7gYQHb0qhDBkzC\"><\/td><td><strong>#<strong>#include &lt;iostream&gt;&nbsp;<\/strong><br><strong>using namespace std;&nbsp;<\/strong><br><strong>inline int add(int a, int b)&nbsp;<\/strong><br><strong>{&nbsp;<\/strong><br><strong>&nbsp;&nbsp;&nbsp;&nbsp;return a+b;&nbsp;<\/strong><br><strong>}&nbsp;<\/strong><br><strong>int main()&nbsp;<\/strong>                                         <br><strong>{&nbsp;<\/strong><br><strong>&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; \"The addition of 562 and 451 gives the value: \" &lt;&lt; 562+451 &lt;&lt; \"n\";&nbsp;<\/strong><br><strong>&nbsp;&nbsp;&nbsp;&nbsp;return 0;&nbsp;<\/strong><br><strong>}&nbsp;<\/strong><br><\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>If one has to declare the inline function in a Class in C++ explicitly, then declaring the function inside the class and defining it outside the class using the inline keyword is the only requirement. However, an inline function can be defined inside a class as well. Following is an example of C++ code to help you get a better view of implementing an inline function while dealing with classes.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ninline int A::add(int a, int b)\/\/Inline function definition\n{\nreturn (a&gt;b)?a:b;\n} \n\n\nclass A\n{\n public:\n    inline int max(int a, int b)\/\/Inline function declaration with definition\n    {\n       return (a&gt;b)?a:b;\n    };\n}\n\nclass A\n{\n public:\n    int max(int a, int b);\/\/Inline function declaration\n}\n<\/pre><\/div>\n\n\n<p>At the time of compilation, this inline function max(a,b) in the above example works in the same way as the inline function add(a,b) in the previous example.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"advantages-of-using-inline-functions\"><strong>Advantages of using Inline Functions<\/strong><\/h2>\n\n\n\n<p>The Inline function is quite a useful feature provided by C++ due to its several advantages that are listed below.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>No function call overhead occurs; hence enhanced program speed is obtained.<\/li>\n\n\n\n<li>It helps in saving the overhead of return call from a function.<\/li>\n\n\n\n<li>Helpful while calling a function in saving the overhead of variables push\/pop on the stack.<\/li>\n\n\n\n<li>The utilisation of the instruction cache increases the locality of reference.<\/li>\n\n\n\n<li>Inlining a function often yields less code than the function call preamble and return, thus useful for the small embedded systems.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"disadvantages-of-inline-functions\"><strong>Disadvantages of Inline Functions<\/strong><\/h2>\n\n\n\n<p>Any reliable feature you name in a programming language comes with its own set of cons, and so is with the inline functions of C++.&nbsp; Let\u2019s see the disadvantages of inline functions now!<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Due to code expansion, the size of the binary executable program is increased.<\/li>\n\n\n\n<li>Any change in the inline function code would need you to recompile the program to ensure it is updated.\u00a0<\/li>\n\n\n\n<li>An increase in the page fault leads to poor program performance due to its increased executable size.<\/li>\n\n\n\n<li>For the systems with a large executable code, the call and return overhead time of its functions is negligible compared to their whole execution time. But, inlining the functions of such a program can bring down the speed of the system. So, it might not turn out to be a good option always, like in the case of large embedded systems which prefer high speed over sizeable executable size.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"points-to-be-kept-in-mind\"><strong>Points to be kept in mind<\/strong><\/h3>\n\n\n\n<p>As an overview of the whole topic of inline functions in C++, here are a few essential points necessary to be remembered about the inline functions while using C++ language.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Inline functions are only suggestions, not compulsions. It is possible that the compiler does not inline the functions marked as inline by the programmer. Simultaneously, the compiler can decide to inline a function even if it is not marked as inline.\u00a0<\/li>\n\n\n\n<li>Functions that are declared and defined inside a class need not be defined as inline functions explicitly since they are already treated as inline functions by default.<\/li>\n\n\n\n<li>Unlike pre-processor macros, Inline is easy to debug and does not corrupt the namespaces, code as it behaves as a compiler controlled copy &amp; paste action and not implemented forcibly.<\/li>\n\n\n\n<li>Except for the conditions where the object\u2019s type is known to the compiler, i.e. when the object has been declared and constructed inside the same function body, virtual methods cannot be inlined.<\/li>\n\n\n\n<li>The presence of a method or function used as a template in the header section does not make it automatically inlined.\u00a0<\/li>\n<\/ul>\n\n\n\n<p>This brings us to the end of the blog on Inline Functions in C++. Hope this helps you to up-skill your C++ skills. To learn more about programming and other related concepts, check out the courses on&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.mygreatlearning.com\/academy\/#our-courses\" target=\"_blank\">Great Learning Academy<\/a>.&nbsp;<\/p>\n\n\n\n<p>Also, if you are preparing for Interviews, check out these&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.mygreatlearning.com\/blog\/cpp-interview-questions\/\" target=\"_blank\">Interview Questions for C++<\/a>&nbsp;to ace it like a pro.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Out of several exciting concepts of C++, the inline functions can prove to be pretty useful when it comes to the performance of a program. Before making a function inline, it is quite essential to have the know-how and know-what of the inline functions. Without any further ado, let\u2019s jump straight into our topic! Inline [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":25682,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[25860],"tags":[],"content_type":[],"class_list":["post-25672","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Inline Functions in C++ | What is Inline Functions in C++<\/title>\n<meta name=\"description\" content=\"Inline Functions in C++: Out of several exciting concepts of C++, the inline functions can prove to be pretty useful when it comes to the performance of a program. Know more about Inline function in c++.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Inline Functions in C++ | What is an Inline Functions in C++\" \/>\n<meta property=\"og:description\" content=\"Inline Functions in C++: Out of several exciting concepts of C++, the inline functions can prove to be pretty useful when it comes to the performance of a program. Know more about Inline function in c++.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/\" \/>\n<meta property=\"og:site_name\" content=\"Great Learning Blog: Free Resources what Matters to shape your Career!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GreatLearningOfficial\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-04-12T00:01:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-30T11:29:46+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"667\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Great Learning Editorial Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/Great_Learning\" \/>\n<meta name=\"twitter:site\" content=\"@Great_Learning\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Great Learning Editorial Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/\"},\"author\":{\"name\":\"Great Learning Editorial Team\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\"},\"headline\":\"Inline Functions in C++ | What is an Inline Functions in C++\",\"datePublished\":\"2021-04-12T00:01:00+00:00\",\"dateModified\":\"2024-04-30T11:29:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/\"},\"wordCount\":1200,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/shutterstock_229153663.jpg\",\"articleSection\":[\"IT\\\/Software Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/\",\"name\":\"Inline Functions in C++ | What is Inline Functions in C++\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/shutterstock_229153663.jpg\",\"datePublished\":\"2021-04-12T00:01:00+00:00\",\"dateModified\":\"2024-04-30T11:29:46+00:00\",\"description\":\"Inline Functions in C++: Out of several exciting concepts of C++, the inline functions can prove to be pretty useful when it comes to the performance of a program. Know more about Inline function in c++.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/shutterstock_229153663.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/shutterstock_229153663.jpg\",\"width\":1000,\"height\":667,\"caption\":\"inline functions C++\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/inline-functions-in-cpp\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"IT\\\/Software Development\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/software\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Inline Functions in C++ | What is an Inline Functions in C++\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"name\":\"Great Learning Blog\",\"description\":\"Learn, Upskill &amp; Career Development Guide and Resources\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"alternateName\":\"Great Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\",\"name\":\"Great Learning\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"width\":900,\"height\":900,\"caption\":\"Great Learning\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/GreatLearningOfficial\\\/\",\"https:\\\/\\\/x.com\\\/Great_Learning\",\"https:\\\/\\\/www.instagram.com\\\/greatlearningofficial\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/in.pinterest.com\\\/greatlearning12\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/beaconelearning\\\/\"],\"description\":\"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.\",\"email\":\"info@mygreatlearning.com\",\"legalName\":\"Great Learning Education Services Pvt. Ltd\",\"foundingDate\":\"2013-11-29\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"1001\",\"maxValue\":\"5000\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\",\"name\":\"Great Learning Editorial Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"caption\":\"Great Learning Editorial Team\"},\"description\":\"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.\",\"sameAs\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/\",\"https:\\\/\\\/in.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/Great_Learning\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCObs0kLIrDjX2LLSybqNaEA\"],\"award\":[\"Best EdTech Company of the Year 2024\",\"Education Economictimes Outstanding Education\\\/Edtech Solution Provider of the Year 2024\",\"Leading E-learning Platform 2024\"],\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/author\\\/greatlearning\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Inline Functions in C++ | What is Inline Functions in C++","description":"Inline Functions in C++: Out of several exciting concepts of C++, the inline functions can prove to be pretty useful when it comes to the performance of a program. Know more about Inline function in c++.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/","og_locale":"en_US","og_type":"article","og_title":"Inline Functions in C++ | What is an Inline Functions in C++","og_description":"Inline Functions in C++: Out of several exciting concepts of C++, the inline functions can prove to be pretty useful when it comes to the performance of a program. Know more about Inline function in c++.","og_url":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/","og_site_name":"Great Learning Blog: Free Resources what Matters to shape your Career!","article_publisher":"https:\/\/www.facebook.com\/GreatLearningOfficial\/","article_published_time":"2021-04-12T00:01:00+00:00","article_modified_time":"2024-04-30T11:29:46+00:00","og_image":[{"width":1000,"height":667,"url":"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg","type":"image\/jpeg"}],"author":"Great Learning Editorial Team","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/Great_Learning","twitter_site":"@Great_Learning","twitter_misc":{"Written by":"Great Learning Editorial Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/#article","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/"},"author":{"name":"Great Learning Editorial Team","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad"},"headline":"Inline Functions in C++ | What is an Inline Functions in C++","datePublished":"2021-04-12T00:01:00+00:00","dateModified":"2024-04-30T11:29:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/"},"wordCount":1200,"commentCount":0,"publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg","articleSection":["IT\/Software Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/","url":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/","name":"Inline Functions in C++ | What is Inline Functions in C++","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/#primaryimage"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg","datePublished":"2021-04-12T00:01:00+00:00","dateModified":"2024-04-30T11:29:46+00:00","description":"Inline Functions in C++: Out of several exciting concepts of C++, the inline functions can prove to be pretty useful when it comes to the performance of a program. Know more about Inline function in c++.","breadcrumb":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/#primaryimage","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg","width":1000,"height":667,"caption":"inline functions C++"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mygreatlearning.com\/blog\/inline-functions-in-cpp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/www.mygreatlearning.com\/blog\/"},{"@type":"ListItem","position":2,"name":"IT\/Software Development","item":"https:\/\/www.mygreatlearning.com\/blog\/software\/"},{"@type":"ListItem","position":3,"name":"Inline Functions in C++ | What is an Inline Functions in C++"}]},{"@type":"WebSite","@id":"https:\/\/www.mygreatlearning.com\/blog\/#website","url":"https:\/\/www.mygreatlearning.com\/blog\/","name":"Great Learning Blog","description":"Learn, Upskill &amp; Career Development Guide and Resources","publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"alternateName":"Great Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mygreatlearning.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization","name":"Great Learning","url":"https:\/\/www.mygreatlearning.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","width":900,"height":900,"caption":"Great Learning"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/GreatLearningOfficial\/","https:\/\/x.com\/Great_Learning","https:\/\/www.instagram.com\/greatlearningofficial\/","https:\/\/www.linkedin.com\/school\/great-learning\/","https:\/\/in.pinterest.com\/greatlearning12\/","https:\/\/www.youtube.com\/user\/beaconelearning\/"],"description":"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.","email":"info@mygreatlearning.com","legalName":"Great Learning Education Services Pvt. Ltd","foundingDate":"2013-11-29","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"1001","maxValue":"5000"}},{"@type":"Person","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad","name":"Great Learning Editorial Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","caption":"Great Learning Editorial Team"},"description":"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.","sameAs":["https:\/\/www.mygreatlearning.com\/","https:\/\/in.linkedin.com\/school\/great-learning\/","https:\/\/x.com\/https:\/\/twitter.com\/Great_Learning","https:\/\/www.youtube.com\/channel\/UCObs0kLIrDjX2LLSybqNaEA"],"award":["Best EdTech Company of the Year 2024","Education Economictimes Outstanding Education\/Edtech Solution Provider of the Year 2024","Leading E-learning Platform 2024"],"url":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"}]}},"uagb_featured_image_src":{"full":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg",1000,667,false],"thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663-150x150.jpg",150,150,true],"medium":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663-300x200.jpg",300,200,true],"medium_large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663-768x512.jpg",768,512,true],"large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg",1000,667,false],"1536x1536":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg",1000,667,false],"2048x2048":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg",1000,667,false],"web-stories-poster-portrait":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg",640,427,false],"web-stories-publisher-logo":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg",96,64,false],"web-stories-thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/02\/shutterstock_229153663.jpg",150,100,false]},"uagb_author_info":{"display_name":"Great Learning Editorial Team","author_link":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"},"uagb_comment_info":0,"uagb_excerpt":"Out of several exciting concepts of C++, the inline functions can prove to be pretty useful when it comes to the performance of a program. Before making a function inline, it is quite essential to have the know-how and know-what of the inline functions. Without any further ado, let\u2019s jump straight into our topic! Inline&hellip;","_links":{"self":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/25672","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/comments?post=25672"}],"version-history":[{"count":14,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/25672\/revisions"}],"predecessor-version":[{"id":111508,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/25672\/revisions\/111508"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media\/25682"}],"wp:attachment":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media?parent=25672"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/categories?post=25672"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/tags?post=25672"},{"taxonomy":"content_type","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/content_type?post=25672"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}