Which statement is true regarding the difference between inline functions and macros in C?
- Inline functions can have local variables
- Inline functions cannot be used with conditional compilation
- Macros are preprocessed
- Macros are type-safe
Macros in C are preprocessed, meaning they are replaced by their definitions before compilation. This can lead to unexpected behavior and debugging challenges. In contrast, inline functions are compiled as proper functions with type safety and can have local variables.
Loading...
Related Quiz
- In a two-dimensional array declared as int arr[5][10];, the expression arr[i][j] refers to the ________ element in memory.
- You are writing a C program where you need to maintain a counter that persists across multiple function calls. Which type of variable would you use?
- When a floating-point number is declared using the ________ keyword, it allows for more precision than a regular float.
- How does the 'register' keyword affect the storage of a variable in a C program?
- The use of inline functions can potentially lead to faster execution time but may also increase the ________ of the binary.