Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Array challenge

Hi all, I am stuck. I am on the third part of the array challenge...the first two parts were clear but on the last line of code I'm getting stuck. I have to assign the variable bravo to the second element of the array letters... i has to do the same thing last step with alpha and it was correct but when I use the same method to write for beta it keeps coming back wrong, I'm getting a message that arrays are 0 based and start with zero...but alpha starts with zero so how can bravo as well? Anyone know what i'm doing wrong here?

char alpha = 'a'; char bravo = 'b';

char letters[2]; letters[0] = alpha; letters[1] = beta;

Can you link to the challenge?

9 Answers

I just ran through all the challenges and got it right...hmm. Maybe try it in a different browser?

Seemingly you answer is correct. Maybe try putting everything on it's own line.

Here is the answer for the first 3:

char alpha = 'a';
char bravo = 'b';

char letters[2];
letters[0] = alpha;
letters[1] = bravo;

hmm, that actually is how i put it in....and it still says it's wrong. :(

hmm, that actually is how i put it in....and it still says it's wrong. :(

I will give that a try, thank you.

I just did it in firefox instead of safari and am still getting the same message that "Bummer! As a reminder, arrays are zero based and start with 0."

I'm not sure what to do next.

char alpha = 'a'; char bravo = 'b'; char letters [2]; letters[0] = alpha; letters[1] = beta;

Like I said, I ran though the challenges in safari, and got all of them right. So i honestly don't know then : / Try copy/paste what I wrote?

i noticed you had = beta;

oh my goodness, never mind. It DID work in the new browser, when I cut and pasted what I tried to do on here I made a dumb word mistake in the last line so that was on me, changing browsers did the trick, thank you!

char alpha = 'a'; char bravo = 'b';

char letters [2];
letters[0] = alpha;
letters[1] = bravo;

printf("alpha %c\n", letters[0]);
printf("bravo %c\n", letters[1]);

works in xcode,,, not exactly what the tutorial is looking for though,,,,, not sure why.

Simply because, in challenge 4, it asks for one printf statement. Not two.