Why when I print it appears 80 for *str in decimal (letter P in ASCII)?

Your last print says to print the character pointed to by str as a decimal, which is exactly what it did (for a memory location you just deallocated, making this undefined behavior).

Leave a Comment