201505 C#初級班-function進階
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static public void function(int x)
{
x = 5;
Console.WriteLine("x:" + x.ToString());
}
static void Main(string[] args) //static靜態 void 不回傳值 Main 進入點
{
int a = 1;
function(a);
Console.WriteLine("a:" + a.ToString() + "\n");
Console.ReadKey();
}
}
}
result:
x=5
a=1
Comments
Post a Comment