I\'m a total C newbie, I come from C#. I\'ve been learning about memory management and the malloc() function. I\'ve also came across this code:
malloc()
char
Your call to malloc will allocate 3 bytes of memory. sizeof(char) is 1 byte and 2 bytes are indicated explicitly. This gives you enough space for a string of size 2 (along with the termination character)
malloc
sizeof(char)