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 |
Explain the static member function.
Explain the difference between new() and malloc() in c++?
Comment on local and global scope of a variable.
What is static in c++?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.
What are the differences between a struct in C and in C++?
Explain how would you handle a situation where you cannot call the destructor of a local explicitly?
Where Malloc(), Calloc(), and realloc() does get memory?
What is difference between c++ and c ++ 14?
What is the difference between while and do while loop? Explain with examples.
What is the difference between = and == in C?
20 Answers Christ University, Intel,
What is the size of a vector?