when we use the pointer in C, what time do we need to use malloc?and why do we need to use malloc? : 
[enter image description here][1]
why it's wrong when i define ans in this case

[enter image description here][2]
and when it will not wrong when i puls the malloc

why?
Thans in advance!


  [1]: https://i.stack.imgur.com/VB2vH.png
  [2]: https://i.stack.imgur.com/r0PWq.png