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
Andrew Neary
Courses Plus Student 939 PointsHelp 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
Lukasz R
707 Pointsfloat the_radius = 14.5;
is the only thing which you need there :)
Lukasz R
707 Pointschar alpha = "a";
char bravo = "b";
That should do the job :)
Andrew Neary
Courses Plus Student 939 Pointsthank you
Grant Johnson
272 Pointschar alpha = 'a'; char bravo = 'b';
because char variables require '' (int and float do not)
Thanks Lukasz R
Brian De Borba
543 PointsHI, 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?
Grant Johnson
272 PointsAre you using ' or "?
Brian De Borba
543 PointsNo, I just typed char alpha = "a"; char bravo = "b";
Grant Johnson
272 PointsChange them to ' --> char alpha = 'a'; char bravo = 'b';
Brian De Borba
543 Pointsthat didn't work,
I assume that I don't need to be on my Mac to take the challenge. Correct?
Grant Johnson
272 PointsThat 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.
Brian De Borba
543 PointsIn the challenge, you wrote: char alpha = 'a'; char bravo = 'b';
You just wrote those two lines and nothing else?
Grant Johnson
272 PointsI 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.
Brian De Borba
543 PointsGot it! Thanks!! Not sure why that didn't work earlier. I refreshed the page, tried the challenge again, and it worked.
Grant Johnson
272 Pointsgreat!
Andrew Neary
Courses Plus Student 939 PointsAndrew Neary
Courses Plus Student 939 PointsThank you, but I am still getting an error
Lukasz R
707 PointsLukasz R
707 PointsAhh my mistake. Should be
float radius = 14.5;You don't have freedom of choosing your variables names here :(Andrew Neary
Courses Plus Student 939 PointsAndrew Neary
Courses Plus Student 939 Pointsthank you tho helped a lot
Lukasz R
707 PointsLukasz R
707 PointsNo prob :) Good luck! :)
Andrew Neary
Courses Plus Student 939 PointsAndrew Neary
Courses Plus Student 939 PointsSorry 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