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

followed the function video to build a function that works in xcode to add two floats together however doesn't work here

float addTwo(float a, float b);
int main()
{
    float a = 1.0;
    float b = 2.0;
    printf("addTwo %f\n", addTwo(a, b));
    return 0;
}
float addTwo(float a,float b) {
    return a + b;
}

Here's the build

functions.c

2 Answers

You've done too much - the question states No need to write the main function. Just write out the implementation for the addTwo function. So you just need to enter the function you have, correctly, written:

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

Steve.

Thanks for the help Steve, I have closure now...