C, reading multiple numbers from single input line (scanf?)

Posted by michal on Stack Overflow See other posts from Stack Overflow or by michal
Published on 2010-03-29T17:05:27Z Indexed on 2010/03/29 17:13 UTC
Read the original article Hit count: 222

Filed under:
|
|

Hi, I'm writing an app in pure C which expects two line at input: first one, which tells how big an array of int will be, and the second, which contains values, separated by space. So, for the following input 5 1 2 3 4 99 I need to create an array containing {1,2,3,4,99}

Now, my question is - what is the fastest (yet easy ;)) way to do so? My problem is "how to read multiple numbers without looping through the whole string checking if it's space or a number" ?

Thanks m.

© Stack Overflow or respective owner

Related posts about c

    Related posts about c99