Need help with understanding malloc & realloc
Hi there! I'm practicing dynamic memory allocation and copied a small program to play around with it. From my current understanding given the allocation of description = malloc(15 * sizeof (char)) the size of description should be 15bytes and it should show an error if I were to use strcat to add more text to the string in description. But when I print the size of description it is 8 in both cases before and after realloc 20*sizeof(char), despite using strcat and BOTH times the string is too large for the space allocated. Can someone help me with this? Here is the code and output: Output: Name: Adam Description: Adam is a DPS student. 8 Name: Adam Description: Adam is a DPS student. He is 24 years old. 8 https://code.sololearn.com/cHprnSgcPvIh/?ref=app