Inline Function in C++
Monday 20 March 2017
Programming in C Plus Plus
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;
}
Inline function Ka Shi dedication bta dete
ReplyDeleteNice sir ji
ReplyDelete