Assuming that the inputs are:
6 4 0 1 2 2 1 0 1 0 0 0 0 1 1 0 0 0 0 1 0 1 1 1 1 0
6 and 4 are width and height respectively. What I used i
You can use gets, strtok and atoi to get it done.
gets
strtok
atoi
Following is complete working code. See here working:
#include #include int main(void) { int w, h, i, j; char buffer[100]; scanf("%d %d", &w, &h); int num[w][h]; gets(buffer); for(i=0; i