Lecture 6 - Slide 40 : 40 |
![]() | The power function on integer type arguments - alternative implementation with an enumeration constant. |
![]() | A more advanced version of the power function - from Stack Overflow. |
![]() | A variant of the more advanced version of the power function. |
![]() | Program output - both versions. |
The 'functions' from above relies on the compiler's ability to evaluate constant expressions, see §C.5 in The C++ Prog. Lang. (3. edition)