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 7988325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:24:38+00:00 2026-06-04T12:24:38+00:00

Do I have to take care of memory when I deal with the enum

  • 0

Do I have to take care of memory when I deal with the enum ?
This is where I declared my enum type. It is in another .h file
This is where I attempt to declare variable
After that Do I have o do something like that

// This is where I declared my enum type. It is in another .h file

    typedef enum CardTypes
    {
        HEART = 1,
        DIAMOND =2,
        CLUB =3,
        SPADE = 4

    } CardType;

    // This is where I attempt to declare variable  

    CardType cardType=SPADE;

    //or

    CardType cardType=malloc(size(CardType));

    // After that Do I have o do something like that

    [cardType release]

    //or

     free(&card)

     Any help will be appreciated , 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. Editorial Team
    Editorial Team
    2026-06-04T12:24:39+00:00Added an answer on June 4, 2026 at 12:24 pm

    This is just a basic C type – and it’s handled just like an int in this regard.

    This is automatic:

    CardType cardType=SPADE;
    

    But when you find you must use malloc, then you would need to free it.

    Typically (e.g. parameter, ivar, local variable), you would declare the enum by value, but (like int) you may occasionally need to use malloc+free.

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

Sidebar

Related Questions

I have the following mapping setup to take care subdirectories, but with this change
I have been investigating transactions and it appears that they take care of themselves
We have an interface which will be implemented by classes that take care of
I have a partial view that I want to basically take care of itself
I have a situation where i have to take input(form) from user. After continue
I have a singleton called SettingsManager in my app that should take care of
I have to take 2 values from DateTimePicker and then compare their values with
Actually I have to take the sequence number in $Revisions field.
I'm writing an application which have to take a picture and send it to
As a web developer I also have to take the Android and iOS web

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.