Your code doesn't use fgets or gets. What is the problem? Does string[s] not contain what you expect? Have you RTFM on scanf?