|
INTERVIEW QUESTIONS
COMPUTER HARDWARE
EMBEDDED SYSTEMS
DETAILS
Question: #define cat(x,y) x##y concatenates x to y. But cat(cat(1,2),3) does not expand but gives preprocessor warning. Why?
Answer: #define cat(x,y) x##y concatenates x to y. But cat(cat(1,2),3) does not expand but gives preprocessor warning. Why?
in this case the cat(x,y) is the macro which is defined by using the preprocessor directive , this will be substituted only at the place where it is called in this example it happens like this
cat(1,2)##3 which will once again become 1##2##3 here if we use ## in between we can join or concatenat only two variables that why it gives a preprocessor warning
________________________ Submitted by Harish Gowda ([email protected])
|
|
|
Category |
Embedded Systems Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 9287 users |
Added on |
5/21/2011 |
Views |
69240 |
Rate it! |
|
|
Question:
#define cat(x,y) x##y concatenates x to y. But cat(cat(1,2),3) does not expand but gives preprocessor warning. Why?
Answer:
#define cat(x,y) x##y concatenates x to y. But cat(cat(1,2),3) does not expand but gives preprocessor warning. Why?
in this case the cat(x,y) is the macro which is defined by using the preprocessor directive , this will be substituted only at the place where it is called in this example it happens like this
cat(1,2)##3 which will once again become 1##2##3 here if we use ## in between we can join or concatenat only two variables that why it gives a preprocessor warning
________________________ Submitted by Harish Gowda ([email protected]) Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What is the output of printf("
abcd ef"); -> ef
|
View Answer
|
|
When you inherit a class using private keyword which members of base class are visible to the derived class?
|
View Answer
|
|
Can u have inline virtual functions in a class?
|
View Answer
|
|
Order of constructor and destructor call in case of multiple inheritance?
|
View Answer
|
|
Is java a pure object oriented language? Why?
|
View Answer
|
|
How would you find out the no of instance of a class?
|
View Answer
|
|
What are the 4 different types of inheritance relationship?
|
View Answer
|
|
Multiple inheritance - objects contain howmany multiply inherited ancestor?
|
View Answer
|
|
Difference between object oriented and object based languages?
|
View Answer
|
|
Scope of static variables?
|
View Answer
|
|
What happens when recursion functions are declared inline?
|
View Answer
|
|
Advantages and disadvantages of using macro and inline functions?
|
View Answer
|
|
Why cannot arrays be passed by values to functions?
|
View Answer
|
|
Can structures be passed to the functions by value?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All Embedded Systems Interview Questions & Answers - Exam Mode /
Learning Mode
|