Can inline functions have a recursion? Give the reason?

Answers were Sorted based on User's Feedback



Can inline functions have a recursion? Give the reason?..

Answer / guest

Calling the by itself, then the function is no longer
called as Inline. Compiler never know how depth of the
recursion at compilation time. Therefore inline functions
cant have a recursion

Is This Answer Correct ?    14 Yes 2 No

Can inline functions have a recursion? Give the reason?..

Answer / sandeep mannarakkal

Inline is a request to the compiler , i.e it may get rejected for the following reasons,
1) If there is recursion (recursion have stack over stack, but inline don't have stack)
2) If static variable is available inside inline function
3) if function definition and implementation are available at different files
4) If there is a function pointer to inline function

Is This Answer Correct ?    0 Yes 0 No

Can inline functions have a recursion? Give the reason?..

Answer / siva

I have tested The answer is....

Yes, you can use but Not preferable.
Inline functions are expanded as macros at compile time.
Generally inline is used if the function has fewer lines of
code.

Is This Answer Correct ?    6 Yes 9 No

Post New Answer

More C++ General Interview Questions

if int1 has the value 12, int has the value 18, and int3 has the value 21, what is the result: int1 < int2 && int2 < int 3

3 Answers  


What is a hashmap c++?

0 Answers  


Why do we use classes in programming?

0 Answers  


What are punctuators in c++?

0 Answers  


What is the role of copy constructor in copying of thrown objects?

0 Answers  






Explain "passing by value", "passing by pointer" and "passing by reference" ?

5 Answers  


Write a program that will count the number of digits in an input integer up to value MAX_VALUE (2147483647). Thus, for an input of 5837 the output should be 4 digits Make sure that your program works for the numbers 0, 1, and 10. For the number 0, the output should be 1 digit

2 Answers  


Which programming language is best to learn first?

0 Answers  


Is c++ a programming language?

0 Answers  


What is the difference between mutex and binary semaphore?

0 Answers  


Is c++ an oop?

0 Answers  


Which should be more useful: the protected and public virtuals?

0 Answers  


Categories