Passing value without reference in C#




      Passing value without reference in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MYPROJECT.startup
{


        class startupday1

        {

            static void Main()

            {

            int y = 0;
            
            func( y);

                Console.Write("new value is {0}\n", y);

                Console.Write("new value is {0}\n", func(y));
                Console.ReadKey();
             }
             static int func( int x)

            {
              x = 10;
              return x;
}

 }

 }


OUTPUT




Comments

Popular posts from this blog

Input and output in C#

Printing Hello World in C#