if you use scanf("%as", &s); memory will be allocated to store just as many characters plus one null character as the string contains. But how do scanf know how many characters the string contains? Or does scanf extend the allocated memory in the meantime?
Ok, here is the problem I want to solve: The user shall enter an arbitrary number of bytes (in integer or hexadecimal form) to the program, and they shall all end up in an array big enough to store them all. When the user has entered all the bytes he will press some special key, like f for finished. Is it possible to make them all end up in an array without first storing them in a linked list? Note that there's no way to tell how many or how few bytes will be entered.