read length of string from stdin
- by teoz
I want to take a string from stdin but I don't want a static array of fixed size
I know that scanf need something where save the stdin input, but I can't do something like this:
char string[10]
scanf("%s",string);
becouse I need to know before how long will be the string in order to allocate the right memory space.
Can you help me to resolve this problem?