What is the difference between macros and inline functions?

Answer Posted / vishal

1> Macros are always expanded by pre-processor, whereas compiler may or may not replace the inline definitions. You cant force compiler to make a function inline. It is purely compiler based decision.

2> Debugging macros is also difficult.

3>  Expressions passed as arguments to inline functions are evaluated once. In some cases, expressions passed as arguments to macros can be evaluated more than once.

Here i got exact answer : http://www.firmcodes.com/difference-macro-inline-c/

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I find the modification date and time of a file?

596


What is huge pointer in c?

575


Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

649


Differentiate between the = symbol and == symbol?

704


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

647






stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.

1844


In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]

1954


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

1526


Explain the difference between #include "..." And #include <...> In c?

621


What is %lu in c?

676


What are the application of void data type in c?

687


Is it valid to address one element beyond the end of an array?

668


Define Array of pointers.

629


What are the types of assignment statements?

622


what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)

1924