Pass valuel by pointer

image_pdfimage_print
   
 
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;
    }
}