I am trying to create an array that to store a user's input, and I need the array to be the exact length of the user's input. I would like to take the length of the user's input, and use this as the length of the array. How can I do this with strlen? Is there any better way?
相关问题
- Multiple sockets for clients to connect to
- how to split a list into a given number of sub-lis
- What is the best way to do a search in a large fil
- How to get the maximum of more than 2 numbers in V
- Faster loop: foreach vs some (performance of jsper
This is one way to acquire memory as you need it. I would use
CHUNKSIZE
more than4
but I restricted it for easy testing.Program session:
Before writing your own function, you can try the following code:
This is an extension to ISO C standard supported on all POSIX.1-2008-conforming systems.