在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace 函数的参数 { class Program { static void mm(ref int x, ref int y) { Console.WriteLine("传入函数mm的参数为:x = {0},y = {1}", x, y); //以下这三句代码为:交换两个参数的值 int temp = x; x = y; y = temp; Console.WriteLine("在执行函数mm后输出的参数值为:x = {0},y = {1}", x, y); } static void Main(string[] args) { int i = 21, j = 34; Console.WriteLine("在Main方法中调用mm函数传入两个参数:i = {0},j = {1}", i, j); mm(ref i, ref j); Console.WriteLine("在Main中执行完mm函数之后:i = {0},j = {1}", i, j); Console.ReadKey(); } } } |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论