C

Asked • 05/19/19

How to define an enumerated type (enum) in C?

I'm not sure what is the proper syntax for using C enums. I have the following code: enum {RANDOM, IMMEDIATE, SEARCH} strategy; strategy = IMMEDIATE;But this does not compile, with the following error: error: conflicting types for ‘strategy’ error: previous declaration of ‘strategy’ was hereWhat am I doing wrong?

1 Expert Answer

By:

Patrick B. answered • 05/19/19

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.