I'd like to split a string and put its element into an array.For example, I have a string
ls -l arg
and an array
I'd like to split that string and assign each substring for elements of the array.The expected result is
I use strktok function with the delimiter is space character but it seems did not work. Do i have to malloc for the array because we do not know the number of substrings?