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];
Answer Posted / 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 |
Post New Answer View All Answers
What will the line of code below print out and why?
How can you quickly find the number of elements stored in a static array?
What are the five basic elements of a c++ program?
How do I tokenize a string in c++?
Write a program using GUI concept for the scheduling algorithms in Operating system like SJF,FCFS etc..
what is software cycle? What is a mission critical system ? What is the important aspect of a real-time system ? Explain the difference between microkernel and macro kernel. Give an example of microkernel.Why paging is used ? Which is the best page replacement algo and Why ? What is software life cycle ? How much time is spent usually in each phases and why Which one do U want to work if selected in Honeywell ? Which are the different types of testing ? What is a distributed system ? Some questions about CSP. Which languages do U know ? What are the differences between Pascal and C. questions from Compiler construction and Lisp. Which are the different computer architecture? What is the requirement in MIMD ? What is the difference between RISC and CISC processors ? Difference between loosely coupled and tightly coupled systems ? What is an open system?
What is a far pointer? where we use it?
What is oop in c++?
What is an operator in c++?
How does the copy constructor differ from the assignment operator (=)?
Where the memory to the static variables is allocated?
Write an algorithm that determines whether or not an almost complete binary tree is a heap.
Explain all the C++ concepts using examples.
What is the difference between struct and class?
What are destructors?