Let's suppose this code:
int i,j=0;
char* block = (char*) (0x9000);
char table[4]= {0x01,0x02,0x03,0x04};
for (i=0; i< 45567; i++) {
*(block +i)= table[j];
j++;
if (j==4)
j=0;
}
I would like to ask:
- Is the memory for
block
allocated in the stack or in the heap? - What problems could happen with this code?
- Can I use
free(block)
at the end of this code?