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 |
Which function should be used to free the memory allocated by calloc()?
What is lvalue?
Which software is used to run c++ program?
Is c the same as c++?
Write a program using merge () function to combine the elements of array x[ ] and y[ ] into array z[ ].
Is c++ slower than c?
Why is c++ considered difficult?
Difference between Abstraction and encapsulation in C++?
Can a constructor be private?
Explain the ISA and HASA class relationships. How would you implement each in a class design?
Does c++ support exception handling?
Explain selection sorting. Also write an example.