If we declare two macro with the same identifier without
doing undef the first, what will be the result?
eg: #define MAX_SIZE 100
#define MAX_SIZE 200
int table1[MAX_SIZE];
Answer Posted / binoy mathew
#include <iostream>
#include <stdlib.h>
#define max 100
#define max 200
int main()
{
printf("%d",max);
return 0;
}
save and run.
[root@localhost Desktop]# g++ test.cpp
test.cpp:5:1: warning: "max" redefined
test.cpp:4:1: warning: this is the location of the previous
definition
[root@localhost Desktop]# ./a.out
200
it shows a warning, but the value used is the latest.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is singleton class in c++?
Explain how would you handle a situation where you cannot call the destructor of a local explicitly?
What is the use of setfill in c++?
Why is c++ called oops?
what Is DCS ? what i will get benefit when i did?
Explain differences between new() and delete()?
What is size of string in c++?
How the virtual functions maintain the call up?
Can we overload operator in c++?
Can we use struct in c++?
Do you know what are pure virtual functions?
Keyword mean in declaration?
What is c++ flowchart?
Is c# written in c++?
Why do we need pointers?