Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

Fundamentals of C, Challenge task 1 of 4

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".

That's the question, and I honestly don't know what I'm doing wrong here.

Here's my syntax:

char *a = "alpha"; char *b = "bravo";

Don't worry, a friend helped me already.

sorry!! i just post my Q on the wrong place.

2 Answers

hello! how did you get the answer? i did my syntax and its showing me a window saying that the code cannot be check at this moment and to try latter so i don't know if i least got it right.

Stone Preston
Stone Preston
42,016 Points

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".

to declare a char variable and assign it a value:

char someCharacter = 'z';

using the * syntax creates a pointer, in this case you just want a char variable, not a char pointer

the char variables need to be named alpha and brava and have the values 'a' and 'b'. You have yours the other way around, chars named a and b and assigned the values 'alpha' and 'bravo'

here is a hint:

char alpha = you have to figure out the rest;

i already corrected and i did it right.

thank you anyways!.