malloc() in C not working as expected

前端 未结 7 712
别那么骄傲
别那么骄傲 2021-01-25 04:52

I\'m new to C. Sorry if this has already been answered, I could\'n find a straight answer, so here we go..

I\'m trying to understand how malloc() works in C. I have this

7条回答
  •  离开以前
    2021-01-25 05:57

    Simply this is one of the case of undefined behavior. You are unlucky that you are getting the expected result.

提交回复
热议问题