Hello,
I am trying to create a 2d array, fill it with characters and then print it out in a console window but the console window crashes without any compiler errors from dev-c++
Code:
#include <curses.h>
#include <stdlib.h>
#define ESC 27 //ASCII for escape
#define ROCK 178
int main() {
//initialize curses
keypad(initscr(),1);
curs_set(0);
int mapX = 20;
int mapY = 20;
int i;
int j;
char mapChar[mapX][mapY];
for(i=0; i<mapY;i++)
for(j=0; i<mapX;j++)
mapChar[i][j] = '#';
while(int run=1){
for(i=0; i<mapY;i++)
for(j=0; i<mapX;i++)
mvaddch(i,j,mapChar[i][j]);
if(getchar() == ESC){
run = 0;
}
}
getch();
return endwin();
}
I'm quite new to C so I'm sorry if it's obvious
Many thanks