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

DJ Segler
DJ Segler
182 Points

Challenge Issue

Working on Obj-C and running into an issue with one of the challenges. Unfortunately, it doesn't provide any hints as to what it's looking for and what I've typed seems correct from what I can tell. Sure would be nice to get a more descriptive response than "bummer".

Here's a link to the challenge: http://teamtreehouse.com/library/arrays-4

And here's what I've typed which seems to match the instructions. Either the instructions are wrong or I'm missing something fundamental...

#include <stdio.h>

int main()
{
   char alpha = 'a';
   char bravo = 'b';
}

6 Answers

I think the only thing you have to write is this:

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

That is, leave out the main function.

DJ Segler
DJ Segler
182 Points

I have done it that way as well. It still doesn't like it.

DJ Segler
DJ Segler
182 Points

Well - now it does.

Did it about 10 times like that on my ipad last night and it never worked so I started adding the other structure components.

If it has only given me a hint like, "You only need to create the variable declarations." Or, "Remember that character declarations should use single quotes instead of double quotes." Etc...

Anything would have been better than "Bummer".

DJ Segler
DJ Segler
182 Points

And so here it goes again... On the last task of that challenge, it's asked me to print out the results. Here's what I've typed:

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

char letters[2] = {alpha, bravo};

printf ("Result is %c \n", letters);

And it doesn't like it, giving me a hint of: "Bummer! The correct format character for a 'char' is '%c'." Clearly, I'm already using '%c'.

Am I missing something?

In part 3 it asked you to assign the variable bravo the the second element in the letters array. I passed with the below solution:

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

char letters[2] = {alpha, bravo};

bravo = letters[1];

printf("letters %c %c", letters[0], letters[1]);
Matthew Mascioni
Matthew Mascioni
20,444 Points

Nice one, Eirik Vale Aase ! Never considered that one.

Matthew Mascioni
Matthew Mascioni
20,444 Points

I just ran through the code challenge. The following code seems to have worked:

printf("letters %c %c", alpha, bravo);

You have the correct format specifier, however, in the instructions, it says your output should look like 'letters a b'. We defined chars 'alpha' and 'bravo' to have the values 'a' and 'b' respectively, already. All we have to do is print them out using the %c format specifier twice, and listing alpha and bravo variables as the second and third arguments for the printf() function.

DJ Segler
DJ Segler
182 Points

Understood. I come from an Actionscript 3 background where I can just add an array itself to the string I'm appending to and it just lists it out... Didn't realize that I have to explicitly list each element.

Thanks for the help and I apologize if my tone is a bit harsh today. A little frustrated that simple things are going so slow. Not enough hints or references to go with the challenges make it more frustrating. Glad you guys are quick to respond here.

Thanks again!

No worries. I too come from ActionScript 3 since that was taught in computer class at my school. Never liked AS3, though - always hated Flash.