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

code challenge

on code challenge for objective-c basics it says " Declare 2 separate variables of type char named "alpha" and "bravo". Assign the letter 'a' to the variable "alpha" and the letter 'b' to "bravo". " but i have no clue how to go about this as it does not show you how to do more than just one char variable?

4 Answers

to declare a variable:

datatype variableName = value;

to declare two variables:

 datatype variableNameOne = value;

 datatype variableNameTwo = value;

so to declare two char variables

char nameOne = 'x';

char nameTwo = 'z';

That should help you out quite a bit.

Peter Hearne, to declare an array with a certain size:

datatype arrayName[x];

replace the x with the size you want the array to be

char myArray[2];

to access the first element of an array and assign it a value (remember array indexes start at zero):

myArray[0] = value;

accessing the second element is the same except you use 1 instead of 0.

thank you so much, there is another question that im unsure about " 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". " i am unsure how to declare an array and size it, and how to assign "alpha" as the first element of array "letters"

thank you so much i understand now :)