AnsweredAssumed Answered

array out of bounds

Question asked by satya reddy on Apr 17, 2014
Latest reply on May 3, 2014 by Fiona Kuang

Hi all,

 

i am trying to fix an issue and working with S12x microcontroller with codewarrior IDE where the functionality of the system works in a random manner. I found the following mistake in the code

 

unsigned char array1[32];

unsigned char array2[23];

 

for(i=0;i<=32;i++)

array1[i] =0;

 

now array1[32] is initialized with 0 which is not available. My question is since array2 is declared just below array1 will that be overwritten. From the map file can i know the address of the array1 and see how it is affecting. Can someone explain how the system in these situations.

 

Thanks and regards,

Satya

Outcomes