I'm creating a program where I need to change the value of an integer that is stored within an array. Here is an instance of what I am talking about:
int num = 0;
int[] nums = new int[] {num};
Console.WriteLine(nums[0]);
nums[0] = 1;
Console.WriteLine(nums[0]);
Console.WriteLine(num);
At the moment, the program outputs 0, 1, 0. Is there a way to modify the value of num by only using the array so that it would output 0, 1, 1?