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 |
Is there a new/delete equivalent of realloc?
What is an operator in c++?
Can notepad ++ run c++?
Explain what are mutator methods in c++?
How does code-bloating occur in c++?
string somestring ; Which of the following choices will convert a standard C++ string object "somestring" to a C string? a) Copy.somestring () ; b) somestring.c_str () c) &somestring [1] d) std::cstring (somestring) e) (char *) somestring
What are c++ variables?
What does new in c++ do?
What are the stages in the development cycle?
What is searching?
Why do we use vector in c++?
Can constructor be static in c++?