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 Objective-C Basics (Retired) Functional Programming in C Functions

Help with the functions challenge!

I tried almost everything, it keeps saying that { is unqualified or something like that, here is my code...

float addTwo (float a, float b);

{ float a = 11.5; float b = 15.5;

int result = addTwo(a, b); printf("addTwo %d\n", result); return 0; }

int addTwo (float a, float b); {return a + b;}

Please help!

2 Answers

Samiruddin Syed
Samiruddin Syed
3,136 Points

When you are adding 2 Float variables, then you have to store the sum of those 2 variables in a "float" variable as well. You cannot store the sum of 2 float variables into an int variable. Hope that helps.

Thank you for replying but now there is a different issue...

expected unqualified-id { ^ 2 errors generated.

that is the problem after I fixed the "int" to "float"

Thank you for replying but now there is a different issue...