unsigned int *a;
a = (int*)malloc(1*sizeof(int));
a[0] = 10;
a[1] = 20;
a[100] = 40;
printf("%u",a[100]);
I have created a pointer named a and allocated 'single' int space for it but still i can store and retrieve more than that. This code runs. Then what is the need of malloc? What is the problem with this method? can i trust the data outside of boundary?