Your
scanf()
statement is wrong, it does not use regular expressions. An easier way would be to use
gets()[
^]. There is also little point in using
malloc()
and
free()
in your subroutine. Just allocate the required number of characters on the stack thus:
char in[20];
Although 20 may not be enough if you want to enter a long string.