error "debug assertion failed"
I was trying out this program but it terminates by saying that debug assertion has failed.
[insert]
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void){
FILE *fp;
char ch;
int nol= 0, not = 0, nob = 0, noc =0;
fp = fopen("C:\Documents and Settings\ROHAN\Desktop\DESKTOP\filejava.txt", "r");
while(1){
ch = fgetc(fp);
if(ch == EOF)
break;
noc++;
if(ch = " ")
nob++;
if(ch = '\n')
nol++;
if (ch = '\t')
not++;
}
fclose(fp);
printf("\n No of char = %d", noc);
printf("\n No of line = %d", nol);
printf("\n No of tab = %d", not);
printf("\n No of space = %d", nob);
return 0;
}
What is the error and what does this imply "debug assertion failed"? I am using Visual Studio c++.