I'm having a problem using an unsigned char as an iterator. Using the following code results in being stuck inside a FOR loop. The output looks like this.
unsigned char i;
char * arr;
int * freq;
arr = (char *)(malloc(256*sizeof(char)));
freq = (int *)(malloc(256*sizeof(int)));
for (i=0; i<=255;i++){
arr[i]=i;
freq[i]=0;
printf("%c",i);
}
My question is why this happens? Is it due to using an unsigned char as an iterator?