Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is a manipulator in c++?

1171


Is c++ an integer?

971


Which operations are permitted on pointers?

945


What is a wchar_t in c++?

1059


write a corrected statement in c++ so that the statement will work properly. x = y = z + 3a;

1823


What do you understand by zombie objects in c++?

1039


What are the comments in c++?

943


How do you declare a set in c++?

910


Describe Trees using C++ with an example.

1087


Define private, protected and public access control.

1063


Write a function that swaps the values of two integers, using int* as the argument type?

966


What is istream c++?

1120


What is c++ namespace?

1143


Can you please explain the difference between using macro and inline functions?

993


What is a container class? What are the types of container classes in c++?

1152