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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:46:47+00:00 2026-06-15T16:46:47+00:00

When I try to explain some simple code to my friends,something strange happens: #include

  • 0

When I try to explain some simple code to my friends,something strange happens:

#include <stdio.h>
int main() 
{
    int x;
    printf("%x\n",x);
}

I have tryed millions of times ,and the last 12 bits of x always turns out to be 0xff0.
I’ve disass the code,but still can’t figure out what’s going on here

My operating system is ubuntu10.10 ,compiler is gcc4.7.2

  • 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-15T16:46:48+00:00Added an answer on June 15, 2026 at 4:46 pm

    First of all, if the value always matches 0xFF0 then the “lower 12 bits” are that value, not the lower 3.

    As for why this happens, you’re reading a variable that you haven’t initialized. That’s undefined behavior, and anything could have happened when you tried to do this, from a crash to a pizza getting delivered.

    But what actually happens is this: the location that x references has some data that it held previously. Chances are that on your setup, that variable happens to contain data whose lower twelve bits are 0xFF0; in which case it’s most likely data associated a previous system call, during processing work done by the system before your main is called.

    To make a long story short: initialize your variables before using them and don’t ask why the uninitialized ones have the value they do.

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

Sidebar

Related Questions

I have some simple code as a repro: var taskTest = Task.Factory.StartNew(() => {
Here's a simple code, where I try to implement some sort of polymorphysm. You
I will try to explain this very simple. So, I skipped any code which
I try to explain my problem. I have a first view in which I
I will try to explain a simple app scenario: My app goes right to
Not sure how to explain this, so I'll first post some code and then
I have some c# code running on sharepoint that i use to check inside
I am probably missing something here, but I'll try and explain what I want
I'm going to try and explain this without showing any code because I don't
I'm trying to split some prior crafted code into a DLL. It's a simple

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.