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 |
Difference between delete and delete[]?
5 Answers Infosys, TCS, Virtusa,
How do we balance an AVL Tree in C++?
What is the difference between public, private, and protected access?
How can you quickly find the number of elements stored in a dynamic array?
What is the importance of mutable keyword?
Are there any special rules about inlining?
What is meant by entry controlled loop? What all C++ loops are exit controlled?
What is the latest version on c++?
Can we make any program in c++ without using any header file and what is the shortest program in c++.
What is rvalue?
Which uses less memory? a) struct astruct { int x; float y; int v; }; b) union aunion { int x; float v; }; c) char array[10];
Describe the main characteristics of static functions?