Hi, I've just been introduced to dynamic memory allocation, so I've written a small test to test out how it works. Can anyone tell me why this doesn't work?
On line 7 you assign a new value to str. str = "dog" doe not copy "dog" to memory location str, it allocates a new string "dog" and makes str point at it. Use strcpy(str, "dog")