⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 make2darraynocatch.h

📁 datastucutre and algorithms, application, in C
💻 H
字号:
// create a 2D array but do not catch exception thrown
// when new fails to allocate sufficient memory

#ifndef make2dArrayNoCatch_
#define make2dArrayNoCatch_

using namespace std;

template <class T>
void make2dArray(T ** &x, int numberOfRows, int numberOfColumns)
{// Create a two-dimensional array.

   // create pointers for the rows
   x = new T * [numberOfRows];
      
   // get memory for each row
   for (int i = 0; i < numberOfRows; i++)
      x[i] = new T [numberOfColumns];
}

#endif

⌨️ 快捷键说明

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