您的问题似乎不完整,您是想询问关于C语言编程的某个具体问题吗?比如C语言的语法、编程技巧、项目开发等。请提供更具体的信息,这样我才能给出更准确的回答。
- 内容介绍
- 文章标签
- 相关推荐
本文共计615个文字,预计阅读时间需要3分钟。
假设有一个长度固定的数组,如何扩容呢?最常见的方法是通过以下方式:
csharpclass Program{ static void Main(string[] args) { int[] arrs=new int[]{1, 2, 3, 4, 5}; arrs[5]=6; // 报错:未处理IndexOutOfRangeException }}
假设有一个规定长度的数组,如何扩容呢?最容易想到的是通过如下方式扩容:
class Program { static void Main(string[] args) { int[] arrs = new[] {1, 2, 3, 4, 5}; arrs[5] = 6; } }
报错:未处理IndexOutOfRanageException,索引超出了数组界限。
本文共计615个文字,预计阅读时间需要3分钟。
假设有一个长度固定的数组,如何扩容呢?最常见的方法是通过以下方式:
csharpclass Program{ static void Main(string[] args) { int[] arrs=new int[]{1, 2, 3, 4, 5}; arrs[5]=6; // 报错:未处理IndexOutOfRangeException }}
假设有一个规定长度的数组,如何扩容呢?最容易想到的是通过如下方式扩容:
class Program { static void Main(string[] args) { int[] arrs = new[] {1, 2, 3, 4, 5}; arrs[5] = 6; } }
报错:未处理IndexOutOfRanageException,索引超出了数组界限。

