Hi, When i run the program below with the array size as 255,the random values are getting stored in the value array correctly.But if I increase the size of the array to 256 only '0's'(zeros) are getting stored at all the locations?How can I overcome this error? is there any limitation for the size of the array in keil? looking for ur help, t.senthil
#include <stdio.h> #include <stdlib.h> #include <LPC22xx.h> void main (void) { unsigned int values [255],i; for (i=0;i<255;i++) values[i]=rand()%100; }
"'0's'(zeros) are getting stored at all the locations" How do you determine that? Are you sure that your entire loop isn't just being optimised away? "is there any limitation for the size of the array in keil?" Implementation details like that will be in the Manual; be sure to read the correct manual - GNU, CARM, or Realview...
How do you determine that? Well I looked into the watch window to see what random values are stored in the array..... Are you sure that your entire loop isn't just being optimised away? i am using the array values for bubble sorting...so I'm sure that there is no place for optimization like Dead code or dead varaible elimination to remove the array values...