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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:10:04+00:00 2026-06-13T21:10:04+00:00

Here’s a quick question. When you use format specifiers in the string you want

  • 0

Here’s a quick question.

When you use format specifiers in the string you want to print, but don’t list any values which you want to replace the placeholders with after the string, you get seemingly random numbers such as 2627389, 6278253 etc. as the output. Here’s an example:

printf("%d %d %d");

The output would look something like:

2621244 4352722 1426724

I was wondering why this happens, and what those numbers mean. If you have an idea, it would really help.
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-13T21:10:06+00:00Added an answer on June 13, 2026 at 9:10 pm

    In most cases, those numbers are “random” values that just happen to be in the stack or in registers depending on the processor. In the olden days, all the parameters to a function were passed on the stack, pushed in reverse order. For printf(), the first parameter, and the last pushed, would be the format string. In your example, the stack would look like:

    sp[0] = "%d %d %d"
    

    printf would grab the top of the stack (the format string) and parse it, grabbing additional parameters in higher stack locations, format them according to the format string and output them appropriately.

    If you had a well formed printf call, e.g. printf(“%d %d %d”, 1, 2, 3), then the stack would look like

    sp[3] = 3
    sp[2] = 2
    sp[1] = 1
    sp[0] = "%d %d %d"
    

    printf would do what you expect: grab the appropriate stack location for each format specifier and format it appropriately. When you don’t pass the other parameters, whatever happens to be in those stack locations are output instead, hence the “random” values.

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

Sidebar

Related Questions

Here is an object that I'd like to use with ng-repeat, but it's not
Here a simple question : What do you think of code which use try
Here is my AsyncTask. Getting exception in the AsyncTask.. private class GetCategories extends AsyncTask<String,
Here's an example query: DECLARE @table table (loc varchar(10)) INSERT INTO @table VALUES ('134a'),
Here's what I'm doing. I want to upload multipart file via Ajax to my
Here are some facts about my app followed by a question My app has
Here is my error(if you need any more info just ask)- Error SQL query:
Here the scenario is I have many .aspx pages if any page gives error,
Here is the scenario: I'm writing an app that will watch for any changes
here is my code, SiteMember class @OneToMany(mappedBy = member,cascade=CascadeType.ALL) private List<MemberThread> memberThread = new

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.