Hi. English is not my native language so I'm sorry if im not correct. When i try to assign 48(ASCII=0)to plansza[0][0] and run the programme it crushes.... Dont know why.... And when i try to assign "x" it says: invalid conversion from 'const char*' to 'char' [-fpermissive]|
What's wrong ? :/
EDIT: Okay i found out it has to be 'x' to make it works properly, but still don't know why the programme crashes.
Line 6: You're trying to allocate your vector of vectors with a size of 0 for each dimension.
Line 13: This has no affect on the size of your vectors. Your vectors have already been allocated with a size of 0.
Line 15: You can't reference the first entry in a vector whose size is 0. That's an out of bounds reference and is what is causing your program to crash.
And when i try to assign "x" it says: invalid conversion from 'const char*' to 'char' [-fpermissive]|
You have two choices.
1) Line 5: Define n as a const and give it a value if you know the value at compile time.
2) Move line 6 to after line 13. Not global, but will use the entered value as the dimension.
Better style to not make it global.
I don't know what you've done, but if you define plansza as a local in main and pass it by reference to the functions that need it, it should not take any more memory assuming you pass by reference.