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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:18:03+00:00 2026-06-13T00:18:03+00:00

Reading this SO question , I started wondering – what is the correct way

  • 0

Reading this SO question, I started wondering – what is the correct way to use scanf/printf (and family) with fixed size types?

For example, if I have short int or int, I’d use %hd and %d respectively – fine.

But what if I have int16_t? short int may be different from int16_t, it’s platform dependent. The same for any other fixed-size (integral) types?


NOTE: As it looks like I received some down-votes, because I “didn’t try to google this“, it looks like I need to explain: I didn’t see similar question here, that’s why I posted it. Most of the questions in SO could have been answered using Google, instead of asking here. That would make StackOverflow not the place, that it actually is now.

And NO, I didn’t do this for reputation – I already hit the daily reputation cap today (having 24 up votes before posting this question).

My point is – I don’t think this deserves down-votes.

  • 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-13T00:18:04+00:00Added an answer on June 13, 2026 at 12:18 am

    The correct way is to use inttypes.h which defines standard macros for printf family and the scanf family, e.g.

    printf ("%" PRId16, short_int);
    scanf ("%" SCNd16, &short_int);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Forgive if this question is silly. I just started reading the SugarCRM developer documentation
When researching for this question and reading the sourcecode in random.py , I started
When reading this question I started to wonder a bit. Say you have these
After reading this question I started to wonder: is it possible to have a
I started with this question: Multiple Javascript gadgets per page . After reading up
I just started reading this article about exception handling in c with the use
After reading this question, I need to clear up some things. IQueryable<Customer> custs =
After reading this question , i saw the answer by Naveen containing a link
I was reading this question, but didn't understand some part of the aix's answer
I was reading this question (which you do not have to read because I

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.