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.

Y. Kravets
10,350 PointsWhat am I doing wrong?
I keep getting the following message: "Bummer! The function does not appear to be returning the correct value. Is the return type a float?"
As you can clearly see I have defined the resulting variable to be a float type - what am I doing wrong?
int addTwo(float a, float b)
{
float sum;
sum = a + b;
return sum;
}
5 Answers

Juan Martinez
1,031 PointsIf this is from the question on the quiz after the video then the answer should look like this
float addTwo(float a, float b);
float addTwo(float a, float b) { float sum; sum = a + b; return sum; }
the float at the beginning of the function is saying that the function will be returning a float value

alex novickis
34,894 Pointsask a question get a question ?
int addTwo(float a, float b) <---- what is the purpose of int here

alex novickis
34,894 PointsYou have "int" at beginning of function definition this specifies a return type
is the caller of this function expecting an int ?

Y. Kravets
10,350 PointsI was under impression that this is how you define a function. Am I wrong?

Y. Kravets
10,350 PointsNo it does not, but whenever I specify ```int addTwo(float a, float b)''' it doesn't work either, which is why I am a bit lost.