zoukankan      html  css  js  c++  java
  • 数组型参数

      如果形参表中包含了数组型能数,那么它必须在参数表中位于最后。另外,参数只允许是矩阵型。数组型参数不能再有ref和out修饰符

    // 数组参数演示
    using System;
    class Test
    {
        static void F(params int[] args)
        {
            Console.WriteLine("Array contains {0} elements:", args.Length);
            foreach(int i  in args) Console.Write("{0} ", i);
            Console.WriteLine();
        }
       
        public static void Main()
        {
            int[] a = {1, 2, 3};
            F(a);
            F(10, 20, 30, 40);
            F();
        }
    }
  • 相关阅读:
    UVa10779
    UVa10779
    C++ 内存管理学习笔记
    c++ 学习笔记
    AcWing 275 传纸条
    I
    Tree HDU6228
    Lpl and Energy-saving Lamps
    C
    Secret Poems
  • 原文地址:https://www.cnblogs.com/netfork/p/3858.html
Copyright © 2011-2022 走看看