Tilemap not rendering properly

I have a code for rendering tiles from tileset.
When I tried 8x8 tilemap it worked.
But when I expanded it to 15x15, weird stuff began to happen.
Here’s tile rendering code with header

worldMap.h

#ifndef WORLDMAP_H
#define WORLDMAP_H

#include <../include/graphics/spriteHandling.h>

#define SCREEN_WIDTH 1280
#define SCREEN_HEIGHT 768
#define TILE_SIZE 32
#define MAP_WIDTH 15
#define MAP_HEIGHT 15

#define TILE_VOID 0
#define TILE_GRASS 1
#define TILE_ROCK 2
#define TILE_WATER 3
#define TILE_WALL 4
#define TILE_SAND 5

#define COLOR_VOID 0, 0, 0
#define COLOR_DEFAULT 255, 255, 255
#define COLOR_GRASS 41, 131, 11
#define COLOR_WATER	40, 91, 246
#define COLOR_SAND 249, 216, 108

int renderTiles(SDL_Renderer* renderer);

#endif

worldMap.c

#include <../include/graphics/worldMap.h>

const char* TILES_PATH = "assets/tilesets/testTiles.bmp";
SDL_Texture* texture = NULL;
SDL_Rect tile[8][8];

/*
 * void 0, grass 1, rock 2, water 3, wall 4 
 * Don't use void!
 */
int tilemap[MAP_WIDTH][MAP_HEIGHT] = {
	{1,1,1,1,1,1,1,1,3,3,3,3,3,3,3}, /* This renders only up to x[8] */
	{1,2,2,2,2,2,2,1,3,3,3,3,3,3,3},
	{1,2,4,4,4,4,2,1,3,3,3,3,3,3,3},
	{1,2,4,3,3,4,2,1,3,3,3,5,5,3,3},
	{1,2,4,5,5,4,2,1,3,3,3,5,5,5,3},
	{1,2,4,5,5,4,2,1,3,3,5,5,5,5,3},
	{1,2,2,2,2,2,2,1,3,3,3,5,3,3,3},
	{1,1,1,1,1,1,1,1,3,3,3,3,3,3,3},
	{2,2,2,2,2,2,2,2,3,3,3,3,3,3,3},
	{2,2,2,2,2,2,2,2,3,3,3,3,3,3,3},
	{5,5,5,5,5,5,5,5,3,3,3,3,3,3,3},
	{3,3,3,3,3,3,3,3,3,3,3,3,3,3,3},
	{3,3,3,3,3,3,3,3,3,3,3,3,3,3,3},
	{3,3,3,3,3,3,3,3,3,3,3,3,3,3,3},
	{3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}  /* This last row renders correctly */
};
/* Position of each tile on testTiles.bmp */
SDL_Rect tile_grass = {0, 0, TILE_SIZE, TILE_SIZE};
SDL_Rect tile_rock = {32, 0, TILE_SIZE, TILE_SIZE};
SDL_Rect tile_water = {0, 32, TILE_SIZE, TILE_SIZE};
SDL_Rect tile_wall = {32, 32, TILE_SIZE, TILE_SIZE};

 /*	Returns 0 on success and 1 on failure */
int renderTiles(SDL_Renderer* renderer) {
	if (texture == NULL) {
		texture = loadTexture(renderer, TILES_PATH, TRUE); /* Textures are loaded correctly */
		if (texture == NULL) {
			printf("Failed to load tileset: %s\n", SDL_GetError());
			return 1;
		}
	}
	/* Creates SDL_Rect grid for each tile */
	if (texture != NULL) {
		for (int x = 0; x < MAP_WIDTH; x++) {
			for (int y = 0; y < MAP_HEIGHT; y++) {
				tile[x][y].x = x * TILE_SIZE;
				tile[x][y].y = y * TILE_SIZE;
				tile[x][y].w = TILE_SIZE;
				tile[x][y].h = TILE_SIZE;
			}
		}
		/* Renders tiles */
		for (int x = 0; x < MAP_WIDTH; x++) {
			for (int y = 0; y < MAP_HEIGHT; y++) {
				switch (tilemap[x][y]) {
				case 0:
					/* Used for debugging only */
					printf("Warning: Void tile! \n");
					SDL_SetTextureColorMod(texture, COLOR_VOID);
					SDL_RenderCopy(renderer, texture, &tile_grass, &tile[x][y]);
					break;
				case 1:
					SDL_SetTextureColorMod(texture, COLOR_GRASS);
					SDL_RenderCopy(renderer, texture, &tile_grass, &tile[x][y]);
					break;
				case 2:
					SDL_SetTextureColorMod(texture, COLOR_DEFAULT);
					SDL_RenderCopy(renderer, texture, &tile_rock, &tile[x][y]);
					break;
				case 3:
					SDL_SetTextureColorMod(texture, COLOR_WATER);
					SDL_RenderCopy(renderer, texture, &tile_water, &tile[x][y]);
					break;
				case 4:
					SDL_SetTextureColorMod(texture, COLOR_DEFAULT);
					SDL_RenderCopy(renderer, texture, &tile_wall, &tile[x][y]);
					break;
				case 5:
					SDL_SetTextureColorMod(texture, COLOR_SAND);
					SDL_RenderCopy(renderer, texture, &tile_grass, &tile[x][y]);
					break;
				}
			}
		}
		return 0;
	}
	return 1;
}

The problem is that it renders only up to tilemap[8][y], X stops at 8 and Y renders as expected.
Even weirder is that X renders correctly at the very last row.
Also there are no errors.

The size of tile is only 8x8.

Oh that’s it, thanks. I looked at it for some time and I didn’t see it. Now I understand why it’s good to take a break sometimes.

So the solution is changing

tile[8][8]

to

tile[MAP_WIDTH][MAP_HEIGHT]

Also I’ll rename it to grid. So thanks again!