C: How to convert a string of ints into actual ints and store them in an array?

Posted by Srinivasa Varadan on Stack Overflow See other posts from Stack Overflow or by Srinivasa Varadan
Published on 2010-03-11T19:13:20Z Indexed on 2010/03/11 19:24 UTC
Read the original article Hit count: 180

Filed under:
|

I have a string "14 22 33 48". I need to insert each of the values in the string into the respective location in the array:

int matrix[5];

so that

matrix[0] = 14;
matrix[1] = 22;
matrix[2] = 33;
matrix[3] = 48;

How do I do this?

© Stack Overflow or respective owner

Related posts about c

    Related posts about string