How to convert a string of ints Eg 45 34 21 22 into int's and store them in an array ? in C programm

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:19 UTC
Read the original article Hit count: 206

Filed under:
|

Hi ,

I have a string val = "14 22 33 48";

        int matrix[5];

I need to insert each of the values in the string into the respective location in the array

Eg: 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 string

Related posts about c