Im trying to make a program that takes your first and last name and writes it out with the last name first. The name has to be stored in one char variable and besides the char variable every other variable has to be of the type Int.
This is my code so far.. I tried to put in while( name[i] > ' ' && name[i] < 0 ) but that didn't seem to work.
I think you had the right idea with your suggestion in bold, but "name < 0" doesn't make sense (char interpretation and negative int values are unrelated) and the other ones are [i]odd at best. What are you trying to do there?
You're probably looking for these comparisons:
1 2
myChar != '\o' // Not 'end of string'
myChar != ' ' // Not a space
With just those two, finding the last name and first name should be a breeze [assuming the input is valid].