ARRAYS

PaulS:
Dynamically declaring arrays like you are doing really isn't a good idea.

Why not? Unless persistent data is needed, its a perfectly valid way of allocating an array to the stack.

@OP

You loop variables are backwards and could possibly be writing out of bounds.

  const int x=createroomRight();
  const int y=createroomStraight();
  int array[x][y];

  for (int i = 0; i < y; i++) {
    int u = 0;
    for (int p = 0; p < x; p++) {
      array[i][p] = 0;

    }
  }

The array is declared

[x][y]

, however you address it like [y][x]