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 trialTanya Binno
143 PointsHelp
I'm brand new to coding, this is literally the first day learning. I'm stuck on this code challenge and can't seem to get it right. Is there a help function I'm not aware of?
4 Answers
RASHU BHATNAGAR
Courses Plus Student 2,669 Pointscan you post the link
Stone Preston
42,016 Pointsusually the link is on the right side of the page under "Related Content" FYI. depends on if the forum poster created the post from the challenge/quiz/video or not though so its not always there.
Tanya Binno
143 PointsThe challenge is: Print the results. Your output should look like "letters a b".
Here is the info:
char letters[2]; letters[0] = alpha letters[1] = bravo
My answer is: printf("letters a b %c\n", letters[0]); printf("letters a b %c\n", letters[1]);
I can't figure out what I'm doing wrong..
Stone Preston
42,016 Points"Your output should look like "letters a b"." You only need one printf statement, and remember the variables you pass to printf show up in the string where you put the format specifiers when output to the console. Try using
printf("letters %c %c", letters[0], letters[1]);
see how I put the format specifiers where I want the values of the variables to show up?
RASHU BHATNAGAR
Courses Plus Student 2,669 Pointsletters[0] = alpha letters[1] = bravo They should be seperated by ; and should be like this: letters[0]=alpha; letters[1]=bravo;
Print the result. Your result should be like letters a b printf("letters %c %c",letters[0],letters[1]);
My answer is: printf("letters a b %c\n", letters[0]); printf("letters a b %c\n", letters[1]); the editor expects you to write the print statement in one line as shown above...
RASHU BHATNAGAR
Courses Plus Student 2,669 PointsDeclare 2 separate variables of type char named "alpha" and "bravo". Assign the letter 'a' to the variable "alpha" and the letter 'b' to "bravo". char alpha='a'; char bravo='b';
Declare an array of type 'char' called "letters" with a size of 2. Assign the variable "alpha" as the first element of the array "letters". char letters[2]; letters[0]=alpha;
Assign the variable "bravo" as the second element of the array "letters". letters[1]=bravo;
Print the result. Your result should be like letters a b printf("letters %c %c",letters[0],letters[1]);
I hope this was the one you were talking about. Its ok things might seem a little hard . But you will soon start getting into the flow.....
Tanya Binno
143 PointsThank you guys very much.. I figured out what I was doing wrong. I'm sure I'll post again soon. Thanks for being so kind :)
Stone Preston
42,016 PointsStone Preston
42,016 Pointsplease post teh code you have currently tried