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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:11:14+00:00 2026-06-18T11:11:14+00:00

Got a question for you all. Many of you will answer ‘it makes no

  • 0

Got a question for you all. Many of you will answer ‘it makes no difference’ but I’m somewhat adamant there is a difference due to the wording of the question:

‘Which class uses the least amount of memory?’

They’re asking for a singular answer – there must be one! I’ve had a chat with a previous Microsoft intern and he’s adamant there is no answer.

Maybe some would care to offer their thoughts?

Which class uses the least amount of memory?

class A 
{
    float duration;
    char code;
    int count;
    bool enabled;
};

class B 
{
    float duration;
    int count;
    char code;
    bool enabled;
};

class C
{
    char code;
    int count;
    bool enabled;
    float duration;
};

class D
{
    bool enabled;
    float duration;
    char code;
    int count;
};
  • 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-18T11:11:15+00:00Added an answer on June 18, 2026 at 11:11 am

    On MSVC2010 I get

    A = 16 bytes
    B = 12 bytes
    C = 16 bytes
    D = 16 bytes

    this is probably due to alignment of the different types. Since char and bool are both small they share a DWORD.

    However this is compiler and platform independent. There is nothing stopping a compiler implementer from making them all the same size or making a char 64 bytes or whatever. The requirements of the standard are quite lax about this kind of thing.

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

Sidebar

Related Questions

Sorry for asking this question, but I searched all Java-related questions, but I got
This question I have asked before and just got answer that there is an
I know that there is many question about it but i can not find
Asked the same question here but got no answer, so I'm trying here instead
Got a question for you all! I'm trying to make a navigation system for
I'm new to PHP first of all .. My question is once I got
Got a question for you javascript gurus out there. I'm creating a sidebar tool
I know that this question has been asked many times ( but in different
I have previously asked a question on AS3 and timing for games but got
I don't know but it may be no sense question to many of you,

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.