Skip to content

Instantly share code, notes, and snippets.

@vxcute
Created November 28, 2020 22:12
Show Gist options
  • Save vxcute/9a0b91166891ebdf9fc87fcc99ccf590 to your computer and use it in GitHub Desktop.
Save vxcute/9a0b91166891ebdf9fc87fcc99ccf590 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace arrays
{
class Program
{
static void Main(string[] args)
{
int[] arr = new int[5] { 1, 2, 3, 4, 5 };
int[] arr2 = new int[5];
Array.Reverse(arr);
foreach(var i in arr) { Console.WriteLine(i); }
Console.WriteLine("======================");
copy_arr_to_arr(ref arr, ref arr2);
foreach(var i in arr2) { Console.WriteLine(i); }
Console.ReadLine();
}
public static void copy_arr_to_arr(ref int[] arr, ref int[] arr2)
{
Array.Reverse(arr);
arr2 = arr;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment