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

kirkbyo
kirkbyo
15,791 Points

What am I doing wrong?

I am getting to learn objective C and I am bit confused when they ask me to return the sum of two floats. I get that I have to use the return function, but I don't get if I am supposed to write it with the "int" function or the "float" function. If anyone could help me out that would be greatly appreciated

1 Answer

Can you write the code is easier if you copy and paste.

kirkbyo
kirkbyo
15,791 Points

int addTwo(int a, int b); int main() { int a = 24; int b = 6; int result = (a, b); printf("add two %d\n", result);
return 0; }

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

Sorry about that. Let me know if this works