Inline functions -Definition,Features - Functions

Q.  Inline functions may not work ______ .

1. If function contain static variables.
2. If function contain global and register variables.
3. If function returning value consists looping construct(i.e. for, while).
4. If inline functions are recursive.
5. If function contains const value.

- Published on 17 Jul 15

a. Only 1,4,5
b. Only 2,3,5
c. Only 1,3,4
d. All of these

ANSWER: Only 1,3,4
 

    Discussion

  • Nihal   -Posted on 12 Oct 15
    Inline functions may not work if
    • If function contain static variables.
    • If function returning value consists looping construct.
    • If inline functions are recursive.
    Inline functions provide following advantages:
    • It reduces Function call overhead.
    • It reduces overhead of a return call from a function.
    • Inline functions are best for small functions
    The syntax for defining the function inline is:
    inline return-type function-name(parameters)
    {
    // function code
    }

Post your comment / Share knowledge


Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)