What is the difference between macros and inline functions?

Answer Posted / rahul sharma

Macro is a must do thing whearas inline is a hint to the compiler. he may choose not to inline if the function seems complex (it uses recursion or many loops)

Macro can have side effects e.g. the typical
SQUARE(++i); problem

but these problem are not there in inline functions

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a char in c?

548


What is declaration and definition in c?

518


Can we declare variable anywhere in c?

533


What does != Mean in c?

579


Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1

3641






Can the “if” function be used in comparing strings?

580


The statement, int(*x[]) () what does in indicate?

638


Explain logical errors? Compare with syntax errors.

618


typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none

703


where are auto variables stored? What are the characteristics of an auto variable?

582


Write a program to check prime number in c programming?

586


In a header file whether functions are declared or defined?

625


What are the complete rules for header file searching?

662


What is the difference between memcpy and memmove?

593


Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58

1113