char *str;
str = malloc(sizeof(char) * 5);
This code allocates 5 consecutive slots of memory to the variable str, which is of type char *.
char *str;
str = malloc(sizeof(char *) * 5);
This is supposed to allocate 5 times the memory of an array of char. But since an array of char has no size until we declare it, what does this statement actually do?