yours is much neater cosmic_cow.. I've another problem.
I need the x coordinate to be between 0 and 19, and the
y coordinate to be between 10 and 19.[As stated in the condition]
I tried entering a coordinate of (5,5). This is supposed to yield
a value of 1. then it's supposed to go through the while loop again but it's not looping! Can someone tell me why? thanks!
FILE* fw = fopen("status.txt", "r");
FILE* fp = fopen("status.txt", "w");
/*Creating a text file which has 20 rows of 20 zeroes*/
fprintf(fp,"%d ", 0);
printf("Please enter the coordinate:\n");
scanf(" %d %d", &x,&y);
invalid=((x>0 && x<19) &&(y>10 && y<19))? 0: 1;
printf("The value of invalid the first time is %d\n", invalid);
/*Reading the status.txt file*/
fscanf(fw, "%d ", &rc);