ox00407538指令引用的内存0xcccccccc.该内存不能为written
这个错误怎么解释呀
这是内容:
Loaded symbols for 'E:\temp\chapter7\Debug\chapter7.exe'
Loaded 'C:\WINDOWS\system32\ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\lpk.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\usp10.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
The thread 0xEC4 has exited with code 0 (0x0).
The thread 0x8DC has exited with code -1073741819 (0xC0000005).
The program 'E:\temp\chapter7\Debug\chapter7.exe' has exited with code -1073741819 (0xC0000005).
代码:
#include<iostream>
#include<fstream>
void test(int len,int& i,bool& bo);
void test1(char answer1[],int &j,bool& bo);
void getscore(char answer[],char answer1[],bool bo,int &sco);
using namespace std;
int main()
{
ifstream indata;
ofstream outdata;
indata.open("exams.txt");
outdata.open("scores.txt");
char answer[21],answer1[30];
char* id;
indata>>answer;
while(indata)
{indata>>id;
indata>>answer1;
bool bo=true,bo1=true;
int i=0,j=0,sco,d;
int len;
for(d=0;d<30&&bo1;d++)
if(answer1[d]!='\0')
len++;
else
bo1=false;
test1(answer1,j,bo);
test(len,i,bo);
getscore(answer,answer1,bo,sco);
outdata<<id<<" ";
if(i==1)
cout<<"Too many answer s";
if(i==2)
cout<<"Too few answer ";
if(j==1)
cout<<"Invalid answers ";
if(bo)
cout<<sco;
cout<<endl;
}
return 0;
}
void test(int len,int& i,bool& bo)
{
if(len<20)
{
bo=false;
i=2;
}
if(len>20)
{
i=1;
bo=false;
}
}
void test1(char answer1[],int &j,bool& bo)
{
for(int k=0;k<20;k++)
if(!(answer1[k]>='a'&&answer1[k]<='f'))
{
j=1;
bo=false;
}
}
void getscore(char answer[],char answer1[],bool bo,int &sco)
{
if(bo)
for(int k=0;k<20;k++)
if(answer1[k]==answer[k])
sco++;
}