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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:38:58+00:00 2026-05-14T04:38:58+00:00

Is it possible to get the memory address of a variable in C#. What

  • 0

Is it possible to get the memory address of a variable in C#.

What I am trying to do is very simple. I want to declare variables of type Double,
Float, Decimal and assign the value 1.1 to each of these variables. Then I would like
to go and see how these values are represented in memory. I need to get the memory
address of the variable in order to see how its stored in memory. Once I have the
memory address I plan to put a break point in the code and use the Debug -> Windows -> Memory
option in visual studio to see how the numbers are stored in memory.

Cheers,

  • 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-14T04:38:58+00:00Added an answer on May 14, 2026 at 4:38 am

    Yes, it is possible to obtain a raw pointer to storage in C#. Rather than try to explain it all here, I recommend that you read all of chapter 18 of the C# specification, which discusses this topic in detail.

    However, if what you want to do is learn how various different floating point types store values, there are easier ways than looking at them in a debugger. These are all well-documented formats; you can just look them up in wikipedia or msdn and read about how they are laid out in memory.

    The binary representation of a Decimal value consists of a 1-bit sign, a 96-bit integer number, and a scaling factor used to divide the 96-bit integer and specify what portion of it is a decimal fraction. The scaling factor is implicitly the number 10, raised to an exponent ranging from 0 to 28.

    See http://msdn.microsoft.com/en-us/library/system.decimal.aspx for details.

    The binary representation of a double is one sign bit, 11 exponent bits representing an exponent from -1022 to +1023, and 52 bits of mantissa, which are interpreted “1.” followed by the 52 bits.

    See http://en.wikipedia.org/wiki/Double_precision or my series of articles on floating point issues: http://blogs.msdn.com/ericlippert/archive/tags/Floating+Point+Arithmetic/default.aspx

    A float is the same as a double, just half the size: one sign bit, 8 exponent bits, 23 mantissa bits. See http://en.wikipedia.org/wiki/Single_precision_floating-point_format for details.

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

Sidebar

Related Questions

Is it possible to get the memory-allocated address of a newly-instantiated class from within
What are all the possible ways in which we can get memory leaks in
I want to apply the DebuggerDisplayAttribute to include an memory address value. Is there
I'm using C#. Is it possible to check how much memory each variable in
Is it possible to get gdb or use some other tools to create a
Is is possible to get login credentials such as name/id if user does login
Is it possible to get a thread dump of a Java Web Start application?
Is it possible to get the x,y coordinates of a Flex app within an
Is it possible to get notified (without polling, but via an event) when a
Is it possible to get the text of an OleDbCommand with all parameters replaced

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.