Quote:
here I have not defined the size of malloc than also
it printing what is the reason
Checking the dynamic memory allocation is your duty, making proper usage of malloc() is your responsability.
C will accept anything until it crash.
Advice: read malloc() documentation.