How can I resize 2d array. I want to create a bool. My new map should measure 10 height and 5 width.

[bool msize(int Height,int Width){


return true;
}]

C++ doesn't really have 2d arrays. Perhaps you can explain in more detail what you want.

I want to make a map. Suppose the map width is 15 and height is 20. After the map is ready, it would be use to write a map. My code is:

#include <iostream>
#include <fstream>
int**map;

bool msize(int Height,int Width){


     return true;
}
bool draw_map(char* Filename,int Width,int Height){

	if(Width<1||Height<1)
		return false;
	msize(Height,Width);
	ifstream file;
	file.open(Filename);

	if(file.is_open()){
			
		while(!file.eof()){	

			for(int x=0;x<Height;x++){

				for(int y=0;y<Width;y++){

					if(c!=']'){
						file >> map[x][y];
						file.get(c);

					}else 
						map[x][y] = -1;
				}
			}

		 }
		file.close();
	}
	return true;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.