When I run your code in C, I get many errors. However, these errors are pretty straight-forward so you'll be able to solve them easily. I am concerned mainly about the logistics of your code.
I can understand what you are doing with your code - asking for a string, going through a for-loop, setting a new array. But there is a major problem in your code, and it lies in your for-loop.
Okay, so your for-loop has a great main idea - get a new array, set
s[i], all of that. And, if executed properly, your code could produce the correct results. However, in this case, your code doesn't produce the proper results. Why is this? Well,
initials.c wants you to print out the initials of a person's name in capital, or uppercase letters. Does your for-loop print out capital letters? You are only setting
name[i], but the only use of
toupper() is on the first letter. You might want to do something like
name[i] = toupper(name[i]).
In addition, how do you know that the letter you are printing is alphabetical? In the more comfortable version of
initials.c, there could be one or more spaces in front of and in between each name. How do you know that you aren't printing the spaces? It might be useful to use an
if statement to check whether or not
name[i] is a space. It might also be useful to check if the letter after
name[i] is a space.
You might want to go back through your code line-by-line and review your thinking process throughout the program. If you fix the errors I stated above - as well as the terminal errors - your code will work beautifully.
If this answers your question, hit the green checkmark! If you still have errors, comment below. :-)