Results 1 to 2 of 2

Thread: pointers

  1. #1

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950

    pointers

    Code:
    int Demo = 5;
    unsafe 
    {
    int * blah;
    blah = &Demo;
    frm.lblValue.Text  = "Value: " + *blah;
    frm.lblAddress.Text = "Address: " + blah;
    return 0;
    }
    In the code above, the bolded line, I want to show the address of varialbe blah. The way it is right now, gives me an error. How do I fix this?

    Thanks,
    Don't anthropomorphize computers -- they hate it

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    lblAddress.Text = ((int)&blah).ToString();
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width