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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:06:28+00:00 2026-05-25T13:06:28+00:00

I wrote a small code of C. #include<stdio.h> int main() { int a =

  • 0

I wrote a small code of C.

#include<stdio.h>
int main()
{
    int a  = 0;
    printf("Hello  World %llu is here %d\n",a, 1);
    return 0;
}

It is printing the following ouput

Hello World 4294967296 is here -1216225312

With the following warning on compilation

prog.cpp: In function ‘int main()’:

prog.cpp:5: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 2 has type ‘int’

I know i need to cast the int to long long unsigned int, but i could not understand the fact that why the later values got corrupted.

Thanks in advance

  • 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-25T13:06:28+00:00Added an answer on May 25, 2026 at 1:06 pm

    %llu expects a 64-bit integer. But you only gave it a 32-bit integer.

    The effect is that what printf is reading is “shifted” over by 32-bits with respect to what you’ve passed. Hence your “1” is not being read in the right location.

    EDIT:

    Now to explain the output:

    a and 1 are being stored 32-bits apart because they are both 32-bit integers.
    However, printf expects the first argument to be a 64-bit integer. Hence it reads it as a + 2^32 * 1 which is 4294967296 in your case. The second value that is printed is undefined because it is past the 1.

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

Sidebar

Related Questions

I wrote this small piece of code to test something: #include <stdio.h> int main()
I wrote a small shellcode below: #include <stdlib.h> int main() { __asm__(jmp calloffset\n poploffset:
Here is the code: #include <QtCore/QCoreApplication> #include <QProcess> #include <QProcessEnvironment> int main(int argc, char
Before the actual implementation, i wrote a small prototype code, and put a class
Here is a small program I wrote, (I am still writing it), however till
This is the code that I want to try to write: #include <stdio.h> #include
I wrote a small code to detect the largest number in the binary tree,
I wrote this small code just to see how an iterator actually gets invalidated
Begginer's question. I'm trying to write small piece of code in Visual Studio (VB.net)
I wrote a small app to send an email using Action_Send. When I start

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.