Saved Bookmarks
| 1. |
What do you understand about inline functions? |
|
Answer» In C or C++, an inline function is a function that is declared using the keyword "inline." It has two FUNCTIONS:
Given below is an example to understand inline functions in a better way: inline void multiplyNums(int x, int y){ int answer = x * y; printf("Product of the two numbers given is: %d", answer);}Let us assume that the above inline function is called at someplace in the main function of our C program as SHOWN below: int i = 20;int j = 40;multiplyNums(i, j);Note that the "multiplyNums(i, j);" function call will be replaced by the following piece of code in the main function itself by the C compiler: int i = 20;int j = 40;int answer = i * j;printf("Product of the two numbers given is: %d", answer); |
|