0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

配列の初期化

Posted at
const int MAX_SIZE = 5;

// サイズを指定する場合
string fruits[MAX_SIZE] = {"apple", "banana", "lemon"};

// サイズを指定しない場合
string fruits[] = {"apple", "banana", "lemon"}

// 配列の配列(二次元配列)の場合
const int ROW = 3;
const int COL = 4; // ROW == COL である必要は無い
int map[ROW][COL] = { { 1, 2, 3, 4 },
                      { 5, 6, 7, 8 },
                      { 9, 10, 11, 12} };

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?