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
Is java the same as c++?
What is basic if statement syntax?
Why was c++ made?
Does c++ have a hash table?
State two differences between C and C++.
Why do you use the namespace feature?
What does new in c++ do?
What is difference between malloc()/free() and new/delete?
Describe about storage allocation and scope of global, extern, static, local and register variables?
How does atoi function work?
What is meant by entry controlled loop?
How does class accomplish data hiding in c++?
Do you know what are the new features that iso/ansi c++ has added to original c++ specifications?
What is a c++ class?
What is a static element?