What is the difference between Inline and Macro? - ProProfs Discuss
Topics
Products
Follow Us:

What is the difference between Inline and Macro?

Asked by G. GRAY, Last updated: Apr 01, 2020

+ Answer
Request

1 Answer

O.Olivia

O.Olivia

Answered Feb 17, 2020

A macro is a fragment of code and is the preprocessor directive stated at the beginning of the program before the hash sign. It is the rule or pattern that determines how input sequences should be worked out according to the defined procedure. An inline function in the c ++ and c programming languages is one qualified with keyword inline. It is a particular concept that is typically used with classes.

The chief difference between macro and inline function is that macro is checked by the preprocessor, while the compiler examines an inline role. In the program, the preprocessor directives are put into the source program before the main program. One type of preprocessor directive is macro. The function can be converted to an inline function if the purpose is not very complicated. In macro, the argument is evaluated each time, and with inline, it is only assessed one time.

 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.