top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Which is better #define or enum?

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

Share this question
Facebook Share Button Twitter Share Button LinkedIn 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
...