Created
March 23, 2022 13:29
-
-
Save ProgrammingFire/d6875d91686b42e58fbeda14d990510a to your computer and use it in GitHub Desktop.
Pointer In C# Like C/C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add <AllowUnsafeBlocks>true</AllowUnsafeBlocks> To Your *.csproj | |
int variable = 481; | |
unsafe | |
{ | |
int* pointer = &variable; // Get The Pointer Of A Variable | |
Console.WriteLine((int)pointer); // Writes The Pointer | |
Console.WriteLine(*pointer); // Writes The Value | |
Console.WriteLine(pointer->ToString()); // Access Properties | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment