ushtabalakh
Programmer
- Jun 4, 2007
- 132
Code:
struct Word {
char *data;
int count;
};
struct Word Words[500];
void main (){
int distWordCount=0;
char *s="foo";
strcpy(Words[distWordCount].data ,s);
}
This code produces the following error
"Unhandled exception at 0x6cb7f6b2 (msvcr80d.dll) in a8.exe: 0xC0000005: Access violation writing location 0x00000000."
And then it shows some assembly file in strcat.asm and one error.
I'm on ms visual c, what's the proper way of copying a string into one element of an array of structures?