Mega Code Archive

 
Categories / C# / Language Basics
 

Pass valuel by pointer

using System; public class Starter {     public unsafe static void Main() {         int val = 5;         int* pA = &val;         int* pB;         pB = MethodA(pA);         Console.WriteLine("*pA = {0} | *pB = {0}", *pA, *pB);     }     public unsafe static int* MethodA(int* pArg) {         *pArg += 15;         return pArg;     } }