|
|
вернуться в форумIt said : "Crash (ACCESS_VIOLATION)", so what's wrong with my code? I sent this program but it said Crash (ACCESS_VIOLATION). I compiled with my Dev-C and Turbo C, both were ok. #include <stdio.h> int main(void) { ...char input[10001], output[81]; ...int i, cursor = 0; ...gets(input); ...for(i=0; i<10000 || input[i] != '\0' || cursor < 80; i++) ...{ ......if(input[i] == '<' && cursor > 0) .........cursor--; ......else if(input[i] == '>' && cursor < 80) .........cursor++; ......else .........output[cursor++] = input[i]; ......} ......output[cursor] = '\0'; ......printf("%s",output); ......return 0; } What's wrong with it? Re: It said : "Crash (ACCESS_VIOLATION)", so what's wrong with my code? Problem says that:"Assume that at the beginning the e-screen contains 80 spaces and the cursor is placed at the first position to the left" I had the same problem. You must fill the output array with spaces |
|
|