Please tell me the difference between following codes: -
Because both time I got Same OUTPUT i.e "How are you".
then What is the use of malloc function?
Line 10: nm is an uninitialized pointer. No telling what it points to.
Line 11: You're copying "How are you?" to an uninitialized pointer. You're wiping out memory somewhere.
Line 24: malloc returns an array of 200 characters setting nm to a valid location on the heap.