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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:30:48+00:00 2026-06-09T08:30:48+00:00

Simply put in C and variants (unlike that wuss java with its virtual machine)

  • 0

Simply put in C and variants (unlike that wuss java with its virtual machine) the size of primitive types on different targets can vary greatly, and there is really no guarantee unless you use the fixed width types defined in stdint.h, and even then your implemenation has to support them.

Anyway hypothetically(because on most modern machines a byte is an octet, for networking purposes I assume(ASCII)) does sizeof return the size of a datatype in bytes or in octets?

  • 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-09T08:30:49+00:00Added an answer on June 9, 2026 at 8:30 am

    Answer: sizeof returns the size of the type in bytes.


    Example: sizeof(char) is 100% guaranteed to be 1, but this does not mean, that it’s one octet (8 bits).


    Proved by the standard:

    in 6.5.3.4, point 2:

    The sizeof operator yields the size (in bytes) of its operand, which may be an
    expression or the parenthesized name of a type. The size is determined from the type of
    the operand. The result is an integer. If the type of the operand is a variable length array
    type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an
    integer constant.

    …

    When applied to an operand that has type char, unsigned char, or signed char,
    (or a qualified version thereof) the result is 1
    . When applied to an operand that has array
    type, the result is the total number of bytes in the array) When applied to an operand
    that has structure or union type, the result is the total number of bytes in such an object,
    including internal and trailing padding.

    Also, in Section 3.6, point 3:

    A byte is composed of a contiguous sequence of bits, the number of which is implementation-defined

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

Sidebar

Related Questions

simply put, i think that the input 'size' field is now obsolete (like the
I recently came across some Java code that simply put some strings into a
There is a bug in Java 6u13 and 6u14. https://bugs.java.com/bugdatabase/view_bug?bug_id=6835450 Simply put, the following
Guys, simply put, I have a java application with a text output box. I'd
Simply put; what does my $99 get me, that I can't already get for
Very simply put: I have a class that consists mostly of static public members,
There are several libraries like ncurses that assist in making command-line GUIs. Simply put,
Simply put, I have these tables. Planning: Date | Machine | Product | PlanningParts
Simply put, I'd like to be able to convert any string to an integer,
Simply put: What is the most effective way to share / reuse code between

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.