Your code assumes the string passed in has at least one space.
It's not clear why you have temp_array in that function.
Do you know what a pointer is, how a array is passed to function and the relationship between pointers and arrays? It might be better to help you with that stuff rather than focusing on this particular function.
It's better to learn to fish than to be given a fish.