参数数组和普通数组
来源:互联网 发布:nba英雄网络链接 编辑:程序博客网 时间:2024/05/21 08:20
参数数组和普通数组
举一个数组求和的例子
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _011_参数数组{ class Program { static int Sum(int[] num) { int sum = 0; foreach(int tem in num) { sum += tem; } return sum; } static int Sum2(params int[] num) //参数数组关键字 params { int sum = 0; foreach (int tem in num) { sum += tem; } return sum; } static void Main(string[] args) { int[] sss = new int[] { 23, 23, 123, 123, 123 }; Console.WriteLine(Sum(sss)); Console.WriteLine(Sum2(22, 56, 7, 4, 34, 34)); //可以直接填入数字,无需定义数组 Console.ReadKey(); } }}
0 0
- 参数数组和普通数组
- 数组类型 普通参数
- 普通变量和数组作为函数参数的区别
- 字符数组和普通数组的区别
- shell的 关联数组 和 普通数组
- C++ cout字符数组和普通数组
- 指针和数组参数
- 数组参数和指针参数
- std::vector 和 普通数组互相转化
- 数组中普通查找和折半查找
- JS中遍历普通数组和字典数组的区别
- swift 普通数组和元组数组排序
- JS中遍历普通数组和字典数组的区别
- 泛型数组列表和普通数组之间的区别
- shell普通数组和关联数组的区别
- 指针数组和数组指针 数组参数传递
- shell 传递参数和数组
- 11、二维数组、数组参数和指针参数
- 我的C++回调函数的理解
- 记录输入三数排序,字符串操作
- Android studio启动到指定Activity
- 集合映射
- Git学习(一)
- 参数数组和普通数组
- 实现jQuery底层链式编程(二)
- 张宴的博客nginx+php+mysql搭建篇
- 游标
- 一个java数学题,给定一个数组,除了一个数出现1次之外,其余数都出现3次,输出出现一次的那个数。
- Rhythm韵:自制音乐app(1f)
- hdoj1084What Is Your Grade?(sort+结构体)
- hdu 5726 (线段树 GCD RMQ)多校第一场1004
- usb-c接口与USB接口的区别