nahidjamalli

Untitled

May 22nd, 2020
1,443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections;
  4. using System.Windows;
  5.  
  6. namespace CSharpConsoleApp
  7. {
  8.     class Program
  9.     {
  10.         static void Main()
  11.         {
  12.             int[] a = new int[3] { 1, 2, 3 };
  13.             f(ref a);
  14.  
  15.             Console.WriteLine(a[0]);
  16.         }
  17.         // REF ilə OUT-un fərqi odur ki, out istifadə olunan dəyişənin inisiallaşdırılmasını(initialize) məcburi tələb etmir, REF isə məcburi tələb edir!
  18.         static void f(ref int[] x)
  19.         {
  20.             x[1] = 532;
  21.             //x = new int[3];
  22.             //x[0] = 9;
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment