Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 183745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:10:13+00:00 2026-05-11T15:10:13+00:00

Part 1 In C, is there any difference between declaring an enum like this:

  • 0

Part 1

In C, is there any difference between declaring an enum like this:

typedef enum{VAL1, VAL2,} firstEnum; 

and like this:

enum secondEnum{Val1, Val2,}; 

Apart from the fact that when using secondEnum, you have to write:

enum secondEnum...; 

Part 2

Also, am I right in thinking that the following is equivalent:

enum{Val1, Val2,} enum1; 

and

enum thirdEnum{Val1, Val2,} enum thirdEnum enum1; 

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:10:14+00:00Added an answer on May 11, 2026 at 3:10 pm

    In part 1, there is obviously a difference – first you are declaring firstEnum as a typedef for the (anonymous) enumerated type, while in the second secondEnum is the tag for the enumerated type and there is not a typedef involved. The first is recommended for the ease of use as you have noted.

    In part 2, the two are not equivalent – the first declares an anonymous enumerated type and defines enum1 to be of that type. The second declares a named enumerated type and then declares enum1 to be of that type. The significance is that you can use the named type in other parts of the code, while in the first you cannot use it anywhere else so you will probably have to use integer values as alias for the values of the enumerated type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 87k
  • Answers 87k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The C++ build system (compiler) knows no difference, so it's… May 11, 2026 at 5:36 pm
  • Editorial Team
    Editorial Team added an answer My problem is the Address Column is only one column… May 11, 2026 at 5:36 pm
  • Editorial Team
    Editorial Team added an answer The classic arguments against VSS are found in Visual SourceSafe:… May 11, 2026 at 5:36 pm

Related Questions

In our project the Java webservice communicate with the backend program written in C
My goal is to get a query written. I have three tables, A, B
I'm new to javascript, my problem is effectively: I have a php page that
The ISO C committee ( ISO/IEC JTC1/SC21/WG14 ) has published TR 24731-1 and is
I hate to resort to dumping problems on other people, and I'm sure this

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.