now I am assumin on you intentions here
that you wanted an array of char 10x10 ... right..
so like this
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
each x is char right...
well when you did
>> char* MapA[10][10];
you ended up with a 10x10 array of pointers... so when you did
>> MapA[i][10] = "OOOOOOOOOO";
you were actually getting
xxxxxxxxx"OOOOOOOOOO"
xxxxxxxxx"OOOOOOOOOO"
xxxxxxxxx"OOOOOOOOOO"
xxxxxxxxx"OOOOOOOOOO"
xxxxxxxxx"OOOOOOOOOO"
xxxxxxxxx"OOOOOOOOOO"
xxxxxxxxx"OOOOOOOOOO"
xxxxxxxxx"OOOOOOOOOO"
xxxxxxxxx"OOOOOOOOOO"
xxxxxxxxx"OOOOOOOOOO"
xxxxxxxxx"OOOOOOOOOO"
where an x is representing an uninitialized ptr and the "ooooo" are string literals.. now this is a perfectly valid data structure, however the reason it was not working is because you cannot change a string literal... you have to either do some clever copies on it, or run through it char by char until you get to where you want, then add char, then finish out the string... or just use arrays and run through char by char
again changed as little as possible...
Code:
#include <cstdlib>
#include <cstdio>
#include <iostream>
using namespace std;
class Map
{
public:
char MapA[10][10];
void mkmap(){
for(int i = 0;i < 10;i++){
for(int j=0; j<10; ++j){
MapA[i][j] = 'O';
cout << MapA[i][j];
}
cout << endl;
}
}
};
int main(int nNumberofArgs, char* pszArgs[])
{
Map mp;
mp.mkmap();
mp.MapA[4][5] = 'A';
cout << endl << endl;
for (int i = 0;i < 10;i++){
for(int j=0; j<10; ++j){
cout << mp.MapA[i][j];
}
cout << endl;
}
return 0;
}