I have a C procedure that is supposed to use a for loop to initialize each element in an array to zero. However, on the first pass, I keep getting this error: Exception thrown at 0x00D25538 in Homework6.exe: 0xC0000005: Access violation writing location 0x036FE514. I've stepped through the code with the debugger, and I haven't seen any obvious problems (then again, as a beginner, I'm not sure I know what to look for). Is there something wrong with my code that could be causing the issue?
Here is my code:
long InitializeArray(long lngMyArray)
{
for (int intIndex = 0; intIndex < lngARRAY_SIZE; intIndex += 1)
{
lngMyArray[&intIndex] = 0; // THIS LINE THROWS THE ERROR
}
return lngMyArray;
}
Thanks for any help, I really appreciate it!