0

I am working on pset2's initials.c where the goal is to return the initials in upper case. I figured out how to get the initials of the first name, but i am not sure how to get the second name. For example if i typed in krubel sahle, i know how to return the 0'th index which is 'k' in uppercase. However, i dont know how to get the letter 's' in uppercase. All i am looking for is a hint.

2

You want hints?

Except for the first initial, what character is always before every initial?

There are a lot of library functions out there, some that you should look at now, like tolower(), isalpha(), and a whole lot more. Since you only wanted a hint, I'll let you think about what else is out there. ;-)

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

1
  • i understand that i need to locate the space character and then add one to it so that i can find the first letter for the second name. How can i translate this into C language. – Krubel Habteyes Jul 31 '16 at 0:34
0

If you are using a variable like int i in a for() loop to iterate through the string, and you find a space character at

string[i]

then you should be able to access the next character at

string[i + 1].

Hope this helps.

2
  • I struggled with the line where you test if (name[I] == " ") Im unsure what syntax changes I need to make – Bijan Khadembashi Aug 26 '16 at 2:25
  • @BijanKhadembashi: try something like: if ((name[i] == ' ') && ( /* Something else you should check for */ )); – hotwebmatter Aug 26 '16 at 4:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .