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

  • SEARCH
  • Home
  • 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 6160497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:18:49+00:00 2026-05-23T21:18:49+00:00

I am doing feature enhancement on a piece of code, and here is what

  • 0

I am doing feature enhancement on a piece of code, and here is what i saw in existing code. If there is a enum or struct declared, later there is always a typedef:

enum _Mode {
   MODE1 = 0,
   MODE2,
   MODE3
};
typedef enum _Mode Mode;

Similary for structure:

struct _Slot {
     void * mem1;
     int mem2;
};
typedef struct _Slot Slot;

Can’t the structures be directly declared as in enum? Why there is a typedef for something as minor as underscore? Is this a coding convention?

Kindly give good answers, because i need to add some code, and if this is a rule, i need to follow it.

Please help.
P.S: As an additional info, the source code is written in C, and Linux is the platform.

  • 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. Editorial Team
    Editorial Team
    2026-05-23T21:18:50+00:00Added an answer on May 23, 2026 at 9:18 pm

    In C, to declare a varaible with a struct type you would have to use the following:

    struct _Slot a;
    

    The typedef allows you to make this look somewhat neater by essentially creating an alias. And allowing variable declaration like so:

    Slot a;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a built in feature in JSTL to output separators while doing foreach?
what am i doing wrong here or is this a feature. My Activity is
I am doing a file resizer feature, and when I use very high resolution
I'm doing my first DLL, a simple HelloWorld SharePoint Feature. The Feature has an
Doing an ajax get request works as expected using the following code: $.ajax({ type:
I am doing some sort of lab test record collection but there is a
I'm doing some tests on the HTTP pipelining feature with C#. Everything works fine
I'm currently learning (by doing) objective-c by implementing a feature I felt is missing
A little known built-in Perl feature is attributes. However, the official documentation is doing
I have a little issue here regarding the modification of Web.Config files in Feature

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.