# Solved: String to Array in C - Splitting word by word



## r3drock3t88 (Jan 13, 2007)

Hey all,

I am still learning the beginning parts of C. What I want to do here is take input from the user, for example ...

"Awesome input man"

And have it split word by word into different sections of an array. So ...

array[0] would hold "Awesome".
array[1] would hold "input"
array[2] would hold "man".

This way I can read them individually later on for processing. Could anyone lead me in the right direction here? As of now I am using the command line arguments for the user to run my program then on that same line type a command, then another command if he/she wishes and so on. But I do not want to use the command line arguments. I want the program to be run, then ask the user for input and when he/she puts input in, it breaks it down like stated above.

Thank you all in advance!

- Sam


----------



## -Fabez- (Jul 28, 2008)

Have you tried using Strtok ?


----------



## r3drock3t88 (Jan 13, 2007)

Thank you, worked like a charm.


----------



## -Fabez- (Jul 28, 2008)

No problems, glad it worked for you


----------

