program.cs

来自「嵌入式开发从基础到提高」· CS 代码 · 共 33 行

CS
33
字号
using System;
using System.Collections.Generic;
using System.Text;

namespace 参数的按值传递
{
/************************
 * 程序描述:测试按值传递实际参数和形式参数变化的关系
 * 创 建 人:ncbcy@eiTarget
 * 版 本 号:1.0.0
 * 修改记录:0
 ***********************/
    class Program
    {
        static void Main(string[] args)
        {
            int intMain = 10;
            Console.WriteLine("在将值传递给形式参数以前的值为:" + intMain);
            cd.cdm(intMain);
            Console.WriteLine("在将值传递给形式参数之后的值为:" + intMain);
            Console.ReadLine();
        }
    }
    class cd
    {
        static public void cdm(int intcdm)
        {
            intcdm += 10;
            Console.WriteLine("形式参数接受了值,这个值被加了10,值为:" + intcdm);
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?