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
Kathy Gleason
Courses Plus Student 596 PointsArray 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;
9 Answers
Thomas Nilsen
14,957 PointsI just ran through all the challenges and got it right...hmm. Maybe try it in a different browser?
Kathy Gleason
Courses Plus Student 596 Pointshttps://teamtreehouse.com/library/arrays-4
like this?
Thomas Nilsen
14,957 PointsSeemingly 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;
Kathy Gleason
Courses Plus Student 596 Pointshmm, that actually is how i put it in....and it still says it's wrong. :(
Kathy Gleason
Courses Plus Student 596 Pointshmm, that actually is how i put it in....and it still says it's wrong. :(
Kathy Gleason
Courses Plus Student 596 PointsI will give that a try, thank you.
Kathy Gleason
Courses Plus Student 596 PointsI 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;
Thomas Nilsen
14,957 PointsLike 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?
Geoffrey Currie
318 Pointsi noticed you had = beta;
Kathy Gleason
Courses Plus Student 596 Pointsoh 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!
Geoffrey Currie
318 Pointschar 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.
Thomas Nilsen
14,957 PointsSimply because, in challenge 4, it asks for one printf statement. Not two.
Thomas Nilsen
14,957 PointsThomas Nilsen
14,957 PointsCan you link to the challenge?