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 trialkyle durand
1,808 PointsStage 2 Functions Challenge Task 1
Hey guys,
Bit stuck on this one..i got the code working in xcode but it doesn't accept it here, so i am obviously doing something wrong!
float addTwo(float a, float b);
{
float one = 20;
float two = 10;
float floatTotal;
floatTotal = one + two;
printf("%f", floatTotal);
return 0;
}
is what i have so far.
Any tips on this one?
2 Answers
Cameron Armstrong
9,406 PointsFirstly you shouldn't use the values 20 and 10 since the numbers to be summed are a and b from the arguments list. Also don't return 0. Return your result. On top of that, the task doesn't actually require you to output the result, just return it. Therefore no printf is necessary in this task. :)
Adam Briest
6,913 PointsThis might help - I was having trouble at the same place you were and it turns out I had a lot more code than necessary for the challenge