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 trialJoey LoForti
Courses Plus Student 1,864 PointsObjective C basics - make a char array called letters size 2 with alpha as the first variable
char letters[] = {'a', 'b'}; printf(%c is alpha and %c is bravo.\n", letters[0], letters[1]);
This is the only thing that works when I put it into Xcode but it does not work in the challenge. This is exactly how he shows to do an int or float array in the video unfortunately he never demonstrates a char array in the video.
I tried
char letters[] = {alpha, bravo}; in Xcode and Xcode didn't like it so I used {a, b} and Xcode didn't like it so I used {'a', 'b'} and Xcode liked it but the challenge won't accept it. What the heck does it want.
1 Answer
Joey LoForti
Courses Plus Student 1,864 PointsI figured it out. This is the answer for any other newbies who are struggling like me.
char alpha;
alpha = 'a';
char bravo;
bravo = 'b';
char letters[] = {alpha, bravo};
printf("letters %c %c\n", letters[0], letters[1]);
What's his face in the video should not assume we have psychic powers. He never demonstrated a char array