Home > Back-end >  The c language
The c language

Time:06-05

C language variable number of input data, intermediate and final input has a space

CodePudding user response:

The scanf judgment by Spaces input end
Know number of data words most directly define a bigger array, or dynamic memory allocation, mallloc colloc, realloc ~ ~ ~

CodePudding user response:

But now I don't know the specific several inputs, so might need a sign like \ n judgment over, but there is a space before \ n it's very troublesome

CodePudding user response:

\ n end judgment is not available, or you can make a line, knock again carriage returns, and apparently circulation receives input, getchar also cannot use

CodePudding user response:

What other methods

CodePudding user response:

You are doing the topic
Questions tend to give input when a certain number of input end of the
If you would like to make something else ~ ~ temporarily can't think of any good idea, not familiar with c language input function, may be can let what you typed in something and not the input is removed from the buffer function of other language is c is not clear, so can detect \ n will not give you input Numbers to eat again

CodePudding user response:

Of course there is also a bad idea, take to receive as a string, and then points out that the figures is straightforward

CodePudding user response:

The 10 have to judge

CodePudding user response:

I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related