unsigned int *a; a = (int*)malloc(1*sizeof(int)); a = 10; a = 20; a = 40; printf("%u",a);
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?