top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Which is better #define or enum?

0 votes
53 views
Which is better #define or enum?
posted Apr 25, 2017 by Pooja Singh

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+1 vote

As far as I understand enum and #define I prefer to use enum since it is a data structure and the list of possible values that an enum can host defined at one place. If In case of #define for n number of statement you have write but in case of enum only at one place you can edit and it reflects its values wherever it is being used.
Debugging is also easy in case of enum. Another advantage of enum is during the run time its variable can get different values based on logic which using MACRO it can't be achieved.

answer Apr 26, 2017 by Vikram Singh
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...