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

Help with simple variable problem

Hi everyone,

I am new to treehouse and am just starting on the iOs development section, and only am a few sections in.

I am having trouble with the variable section challenge.

The challenge:

Create a float variable that has a radius value of 14.5

(I am inputing this)

include <stdio.h>

int main() { float the_radius = 14.5; printf("%f is the radius.\n", the_radius); return 0; }

Even though this is the same format as the instructors video before this challenge it says my work is incorrect. The only feedback i am getting is "Make sure you are creating a float variable and to check the syntax"

Can someone please tell me if they see something wrong in my code, because I am not seeing it

thanks Andrew

9 Answers

float the_radius = 14.5; is the only thing which you need there :)

Thank you, but I am still getting an error

Ahh my mistake. Should be float radius = 14.5; You don't have freedom of choosing your variables names here :(

thank you tho helped a lot

No prob :) Good luck! :)

Sorry to bother you again but I am now having trouble with the array challenge.

The challenge:

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

I am entering

char alpha = a; char bravo = b;

also tried

char a = alpha; char b = bravo;

neither are working can not see why this would be wrong

char alpha = "a"; char bravo = "b"; That should do the job :)

thank you

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

because char variables require '' (int and float do not)

Thanks Lukasz R

HI, I am also new into the iOS development track and I am having issues with the same array challenge. I tried char alpha = "a"; char bravo = "b"; It does not seem to be working. What am I missing?

Are you using ' or "?

No, I just typed char alpha = "a"; char bravo = "b";

Change them to ' --> char alpha = 'a'; char bravo = 'b';

that didn't work,

I assume that I don't need to be on my Mac to take the challenge. Correct?

That worked for me, so sorry then I don't know what the problem is. If you're in a web browser taking the challenge, it shouldn't matter as far as I know.

In the challenge, you wrote: char alpha = 'a'; char bravo = 'b';

You just wrote those two lines and nothing else?

I think so, but I don't remember the challenge that well. If it's just asking you to "declare" it, then that's all you should have to type.

Got it! Thanks!! Not sure why that didn't work earlier. I refreshed the page, tried the challenge again, and it worked.

great!