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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:56:15+00:00 2026-05-11T20:56:15+00:00

Can someone explain the following strange behavior? I run the following program on a

  • 0

Can someone explain the following strange behavior?

I run the following program on a 64-bit Intel platform:

include <stdio.h>
#include <stdint.h>

int main(void)
{
  int x;
  int *ptr = &x;

  printf("ptr = %p\n", ptr);
  printf("sizeof(ptr) = %d\n", sizeof(ptr));

  int64_t i1 = (int64_t) ptr;
  printf("i1 = 0x%x\n", i1);
  printf("sizeof(i1) = %d\n", sizeof(i1));

  return 0;
}

This program produces the following output:

ptr = 0x7fbfffdf2c
sizeof(ptr) = 8
i1 = 0xbfffdf2c
sizeof(i1) = 8

Can anyone explain why i1 contains only the least significant 32 bits of ptr? (Note that it is missing 0x7f).

Compiler: gcc version 3.4.6 20060404 (Red Hat 3.4.6-9)
OS: Linux scream 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007 x86_64 x86_64 x86_64 GNU/Linux
Processor: Intel(R) Xeon(R) CPU E5430  @ 2.66GHz
  • 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-11T20:56:15+00:00Added an answer on May 11, 2026 at 8:56 pm

    It hasn’t gone anywhere .. your print statement is wrong. Try this:

    printf("i1 = 0x%lx\n", i1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone explain to me the following behavior on x64 platform: If I call
Can someone explain the following behavior? Specifically, why does the function return a different
Can someone explain the following behavior in Java sockets: The general idea is this:
Can someone explain the following piece of code int x = 45; int y
Can someone explain what the following assembly code does? int 0x80
Can someone explain me why the following program doesn't work, and how to make
Can someone help explain the following bit of code. richTextBox1.Font = new Font(richTextBox1.Font.FontFamily, richTextBox1.Font.Size,
Can someone explain the behavior of the following def iterate return yield return end
I've run into a really strange bug, that I'm hoping someone can explain. I
can someone explain to me why the following results in b = 13? int

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.