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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:41:34+00:00 2026-05-21T17:41:34+00:00

What are the differences between size_t and std::size_t in terms of where they are

  • 0

What are the differences between size_t and std::size_t in terms of where they are declared, when they should be used and any other differentiating features?

  • 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-21T17:41:34+00:00Added an answer on May 21, 2026 at 5:41 pm

    C’s size_t and C++’s std::size_t are both same.

    In C, it’s defined in <stddef.h> and in C++, its defined in <cstddef> whose contents are the same as C header (see the quotation below). Its defined as unsigned integer type of the result of the sizeof operator.

    C Standard says in §17.7/2,

    size_t which is the unsigned integer type of the result of the sizeof operator

    And C++ Standard says (about cstddef header) in §18.1/3,

    The contents are the same as the Standard C library header , with the following changes.

    So yeah, both are same; the only difference is that C++ defines size_t in std namespace.

    Please also notice that the above line also says “with the following changes” which isn’t referring to size_t. Its rather referring to the new additions (mostly) made by C++ into the language (not present in C) which are also defined in the same header.


    Wikipedia has very good info about range and storage size of size_t:

    Range and storage size of size_t

    The actual type of size_t is
    platform-dependent; a common mistake
    is to assume size_t is the same as
    unsigned int, which can lead to
    programming errors,[3][4] when moving
    from 32 to 64-bit architecture, for
    example.

    According to the 1999 ISO C
    standard (C99), size_t is an unsigned
    integer type of at least 16 bits.

    And the rest you can read from this page at wikipedia.

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

Sidebar

Related Questions

There are any differences between using SetValue with (for example) Canvas.LeftProperty and Margin Property?
What are the differences between preg_replace() and preg_filter() ? In which situations should I
What are the main differences between these WPF controls? And when I should use
Are there any differences between LEA $1000,A0 and MOVE #$1000,A0 to put an address
What are the relevant differences, in terms of performance and use cases, between simulated
I'd like to know in Guava if there are any differences between the Iterables.filter(Iterable,
Is there is a difference between size_t and container::size_type ? What I understand is
The differences between StringBuilder and StringBuffer in Java are well documented and have been
I know the differences between IBAction and IBOutlet, but I don't know when I
What are differences between Visibility.Collapsed and Visibility.Hidden in WPF?

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.