-2

Is this possible? I need to make a 2d array and each element is supposed to have an int array of size 2.

So if I make a 10x10 array I need each index to have a [x, y] where x and y are ints.

nicoqueijo
  • 761
  • 2
  • 9
  • 22

1 Answers1

2
int array[10][10][2];

Here you have a 3D array. Where the 2D array : array[..][..] has 2 elements inside it.

Or you can use structure.

struct number {
  int x;
  int y;
};

then :

struct number array[10][10];
marco-a
  • 5,590
  • 1
  • 17
  • 43
Nicolas Guerin
  • 356
  • 2
  • 17