Inline Function in C++

Inline Function in C++

Inline Function in C++
Ganesh
Monday 20 March 2017

Inline Function-



C++ เคฎें เคœเคฌ เคเค• function เค•ो เค•เคˆ เคฌाเคฐ call เค•िเคฏा เคœाเคฏे เคคो เค•เคˆ เคธाเคฐा memory space เคคเคฅा time เคฒเค—เคคा เคนै เคชเคฐंเคคु function เค›ोเคŸा เคนो เคคो execution time เค•ो เค•เคฎ เค•เคฐเคจे เค•ा เคคเคฐीเค•ा เคนै macros เค•ा เค‡เคธ्เคคेเคฎाเคฒ।

            C เคฎें macros เค•ा เค‡เคธ्เคคेเคฎाเคฒ เค•िเคฏा เคœाเคคा เคฅा เคชเคฐंเคคु เค‡เคธเค•ा เคฏเคน disadvantage เคนै เค•ि macros real function เคจเคนी เคนोเคคे เคนै เคคเคฅा compile เค•เคฐเคคे เคธเคฎเคฏ เค‡เคจเคฎे error check เคจเคนी เคนोเคคी เคนै।
            Inline Function C++ เคฎें function เค•ो call เค•เคฐเคจे เค•ी process เค•ो เค†เคธाเคจ เค•เคฐเคคे เคนुเค เคŠเคชเคฐ เคฆी เค—เคฏी เคธเคฎเคธ्เคฏा เค•े เคธเคฎाเคงाเคจ เค•ो เคช्เคฐเคฆाเคจ เค•เคฐเคคा เคนै, เค•िเคธी เคญी function เค•ो inline เคฌเคจाเคจे เค•े เคฒिเค function เค•े เค†เค—े invoke เคถเคฌ्เคฆ เค•ो เคฒिเค– เคฆिเคฏा เคœाเคคा เคนै।

Inline function เค•ो เคœिเคธ line เคฎें เคฒिเค–ा เคœाเคคा เคนै เคตเคน invoke เคนुเค† เคนो เคตเคนी เคชเคฐ expand เค•เคฐเค•े define เค•िเคฏा เคœा เคธเค•เคคा เคนै।

Inline Function เค•ी calling direct เคนै เคคเคฅा inline keyword compiler เค•ो command เคจเคนी requst เคญेเคœเคคा เคนै เค•ि เค‰เคธे เค•ाเคฐ्เคฏ เค•เคฐเคจे เคฆिเคฏा เคœाเคฏे เคชเคฐंเคคु เค•ुเค› situation เคชเคฐ inline expansion เค•ाเคฎ เคจเคนी เค•เคฐเคคा เคนै เคœैเคธे เค•ि-
(i) เค…เค—เคฐ inline function Recursive เคนो।
(ii) function เค•े เค…ंเคฆเคฐ static เคฎाเคจ เคนो।
(iii) เค…เค—เคฐ function เค•े เค…ंเคฆเคฐ value return เคนो เคฐเคนी เคนो เคคเคฅा เค‰เคธเคจे switch เคฏा goto เค•ा เคช्เคฐเคฏोเค— เค•िเคฏा เคนो।




Example- 
#include<iostream.h>
Inline float add (float a, float b)
{
return(a+b);
}
int main()
{
float a=5.4
float b=7.4
Cout<<add(a,b)
return 0;
}



Open Comments
Close comment

2 comments