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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:02:57+00:00 2026-05-14T03:02:57+00:00

Why does: const char example; (uint64*)example have a value of 140734799798420 and *(uint64*)example have

  • 0

Why does:

const char example;

(uint64*)example have a value of 140734799798420

and

*(uint64*)example have a value of 7004431430466964258

p.s. dont worry about the type cast, I am interested why the second * increases the value.

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-05-14T03:02:58+00:00Added an answer on May 14, 2026 at 3:02 am

    As others have said, you’ve invoked undefined behavior. No particular behavior is guaranteed.

    That said, you see different values because you are printing different locations in memory — the first prints data from the memory location where example is stored, and the second prints data from the memory location stored as the value of example.

    const char example
    

    Defines a char variable on the stack without initializing it, so its value will be garbage; probably whatever was last stored in the location on the stack where it was allocated.

    (uint64 *)example
    

    Interprets the value of example as a pointer to (the address of) a uint64. This prints out the value stored in example as if it were a pointer.

    *(uint64 *)example
    

    Dereferences that pointer. It interprets the value of example as a pointer to (the address of) a uint64, then prints what is at that address as if it were a uint64.

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

Sidebar

Related Questions

Why does the following code in C work? const char* str = NULL; str
The example at: http://www.d-programming-language.org/mixin.html , appears below: template GenStruct(char[] Name, char[] M1) { const
I'm wondering what type types have in c. For example, how would I do
I have a class with an implicit const char * constructor. My intuition tells
OK, so I have a database field of type char(1) that has a small
How does const (pointers, references and member functions) help with thread safety in C++?
This compiles: int* p1; const int* p2; p2 = p1; This does not: vector<int*>
Does Google force employees who have offers from Facebook to leave immediately?
Does the Java language have delegate features, similar to how C# has support for
I followed a simple example as below. But compile failed. Could you please have

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.