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

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