In file count.c, program reads a string from a file and then counts the total number of characters given in the file. Following are the lines of code in file count.c:
#include <stdio.h>
int main()
#define max 1000
{
char c, inpt[max];
int i;
for (i=0; (c=getchar()) !='\n'; ++i){
inpt[i]=c;
}
printf("Count is %d. ",i);
}
Code compiles successfully without any error messages but when I run command:
count.exe < Rehan.txt
Program crashes saying 'count.exe has stopped working'
.
Problem details are:
Problem signature:
Problem Event Name: BEX
Application Name: count.exe
Application Version: 0.0.0.0
Application Timestamp: 53e5d5d5
Fault Module Name: StackHash_e98d
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 00000000
Exception Offset: ffffffff
Exception Code: c0000005
Exception Data: 00000008
OS Version: 6.1.7600.2.0.0.256.1
Locale ID: 1033
Additional Information 1: e98d
Additional Information 2: e98dfca8bcf81bc1740adb135579ad53
Additional Information 3: 6eab
Additional Information 4: 6eabdd9e0dc94904be3b39a1c0583635