The program crashes at strlen.
Possibly because the string that you enter from stdin is larger than the size of the allocated memory.
Few more issues
printf("%stringsize:%d\n",ssize);
Aparently, %s
is interpreted as if, you would be passing a string as a vararg. So per your format string, your printf excepts two arguments of type string and integer consecutively, , but instead ended up passing a singleton integer. You should have coded as
printf("%%stringsize:%d\n",ssize);
In C, casting the return value of malloc
is superfluous.