#include <stdlib.h> int main() { int i = 0; unsigned char (*b)[5]; b = malloc( 5 ); for ( ; i < 100 ; i++ ) { *(b+i)[0] = 192; *(b+i)[1] = 168; *(b+i)[2] = 0; *(b+i)[3] = 1+i; printf( "%d.%d.%d.%d\n", *(b+i)[0], *(b+i)[1], *(b+i)[2], *(b+i)[3] ); } return 0; } In my understanding, the malloc () function allocates only 5 bytes, and at least at the 6th step of the cycle (i == 5) the pointer should go beyond the memory allocated to the process, why does this not happen?
I collect using gcc version 4.9.2 (Debian 4.9.2-10)