How to

get value from pointer

Published: 15. January 2009 | Updated: 15. January 2009
License: Microsoft Public License (MS-PL)
Categories: Framework » Unsafe Code
Tags: C# Unsafe
Was this snippet helpful for you? YESYES / NONO
// assign value to variable
int a = 10;

// create pointer to variable
int* p = &a;

// get value stored in pointer
int b = *p;

Console.WriteLine(b);
Console Output:
10
Send us feedback about this snippet »



Related Snippets: