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 |
What is scope of a variable? (LOLZ)
Why would you make a destructor virtual?
State the difference between pre and post increment/decrement operations.
What is the difference between a class and a structure in C++?
Write a recursive program to calculate factorial in c++.
When is a template a better solution than a base class?
Refer to a name of class or function that is defined within a namespace?
How do you sort a sort function in c++ to sort in descending order?
Out of fgets() and gets() which function is safe to use and why?
Explain the properties and principles of oop.
Explain how functions are classified in C++ ?
What is the difference between operator new and the new operator?