Explain the advantages of using macro in c language?



Explain the advantages of using macro in c language?..

Answer / Akshay Kumar

Macros provide several advantages in C:
1. Inline replacement - Macros replace themselves with their arguments during the preprocessing phase, making them execute faster as there is no function call overhead.
2. Reduced coding - They help reduce code duplication and make the code easier to read by replacing repetitive code.
3. Efficiency - Macros can perform bitwise operations more efficiently than functions because the compiler performs these operations at compile-time.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

write a own function to compare two strings with out using stringcomparition function?

6 Answers   LG Soft, Sasken,


How will you divide two numbers in a MACRO?

1 Answers   Apps Associates,


Does c have class?

1 Answers  


Why c is called a mid level programming language?

1 Answers  


What are the disadvantages of a shell structure?

1 Answers  


how can i sort numbers from ascending order and descending order using turbo c..

1 Answers  


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

1 Answers  


Write a C++ program to give the number of days in each month according to what the user entered. example: the user enters June the program must count number of days from January up to June

0 Answers  


Are pointers integer?

1 Answers  


Why header files are used?

1 Answers  


What's the difference between struct x1 { ... }; and typedef struct { ... } x2; ?

3 Answers  


1,4,8,13,21,30,36,45,54,63,73,?,?.

10 Answers   AMB, Franklin Templeton,


Categories