Science, asked by pinkybarbie3836, 1 year ago

Which is better #define or enum?

Answers

Answered by Samarthattituded
0
ANSWER}
Enums should always be preferred if you are using related data as in case of a State Machine, you can define order in enums also that will help in implementing the State Machine.

Further enums will keep your program safe as all enums will be of its type only so they will avoid any possible confusions too.

#define should not be used in case of a state machine or related data. Anyway thats my suggestion, but there is no hard and fast rule.

Also I would like to add up one more point that enums will add more readability and understandability to your code if used in future or or if read by someone else. It is an important point when you are having a very large program and there are a lot of #defines in the program other than you are using for your State Machine.


2. better difine is only searcing word of dictionary

follow for more answers
Similar questions