-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
  • 872
  • 2
  • 11
  • 28

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
  • 7,007
  • 2
  • 19
  • 49
Nicolas Guerin
  • 356
  • 2
  • 18