mapprinter = new (nothrow) char [mapxc*mapyc+mapyc];
if (mapprinter==0){
cout << "error";
}
for(int i=0;i<mapyc;i++){
map[i] = new (nothrow) char [mapxc];
if (map[i]==0){
cout << "error";
}
}
hmm yea it stops working
i am trying to get memory for the two pointers
map is a double pointerand a char
mapprinter is just a pointer and a char
any tips?
What do you mean by "doesn't work"? Does it crash? Does it print "error"? Does it just not do what you want it to do? Does it quit its job and drink alcoholic beverages at the local bar?
prints the followin error"Unhandled exception at 0x011a2387 in pathfinding1.exe: 0xC0000005: Access violation writing location 0xcccccccc."
and points to map=0xcccccccc....
@xerzi yeah they were documented in one of the old articles on using forum code tags. The numbers can be up to 263 - 2, for reference:
9223372036854775805 9223372036854775806
//
//after this line it breaks
@ToLesto yes, you have to initialize it to something. In your case you need to initialize it to an array of pointers and then for each pointer initialize it appropriately.