in a larger code i have this code:
#define N 10
..
..
..
char Map [N][N] = {"##########",
"#@ #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"##########"};
when i try to compile and run it form Code bloke i gives me the error
F:\C++\Maze\main.cpp|25|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]|
any idea what i did wrong in this simple code?
The length of each row in your example is 10+1=11 (remember the null terminator for string needs space to allocate). So:
#define N 10
#define M 11
char Map [N][M] = {"##########",
"#@ #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"##########"};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With