can someone help me with initials?i`m struggling to get it right as i made it until the for loop:

[mod edit to put code behind link]

but i am clearly missing something because as I print my name I get this:

david lousada DAI OSD

I believe it has something to do with spaces

  • It looks like you're trying to share the needed info to get help, but there's just too much missing. Can you please edit your question and add all of the relevant code, particularly the entire for loop? Also, please explore the help tab at the top of this page. It will explain how to post code so that it formats properly.
    – Cliff B
    Sep 25, 2015 at 21:04
  • thank you Cliff Sep 25, 2015 at 21:14

1 Answer 1


I've also answered on Slack...

The key to this is to understand that you only want to print a char if the char before it is a space. You are mostly there in your printf statement, but you need to test if the char (name[i]) is a space. If it is, then you will print name[i+1] as you are showing.

Also, don't double increment your i ... it is will be increment by the for loop already.

  • thanks a lot curiouswiki I found the solution putting an if statement inside the for loop :) Sep 25, 2015 at 22:18

You must log in to answer this question.

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