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];
Answers were Sorted based on User's Feedback
Answer / 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 |
How many bit combinations are there in a byte?
Why do C++ compilers need name mangling?
Explain the different access specifiers for the class member in c++.
Which of the following operator cannot be overloaded?
Explain one method to process an entire string as one unit?
What is null and void pointer?
what are the iterator and generic algorithms.
What is a c++ vector?
How do you decide which integer type to use?
What is the use of class in c++?
Write about the role of c++ in the tradeoff of safety vs. Usability?
What is the Difference between "printf" and "sprintf"?
7 Answers iSoft, PentaWare, TCS,