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

Trevor Wood
Trevor Wood
17,828 Points

Not sure how to do this, iOS problem

Not quite sure how to return the float value. There may also be some other areas i'm not doing correctly.

functions.c
void addTwo(a,b){
  int here = a+b;
  printf("%s\n",here);
  return 0;
}

1 Answer

Alex Hedley
Alex Hedley
16,381 Points

You'll want to return here since that is the value of the two parameters added together.

void addTwo(a,b){
  int here = a+b;
  return here;
}
Trevor Wood
Trevor Wood
17,828 Points

Thanks Alex, but it says that I should also declare it a float somewhere.

Alex Hedley
Alex Hedley
16,381 Points

read it too quickly you'll want your method to return a float not be a void

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