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

Muhmammad Zaki
Muhmammad Zaki
864 Points

i got this error:expected unqualified-id { ^ 1 error generated. what should i do?

expected unqualified-id { ^ 1 error generated.

what is this error?

functions.c
#include <stdio.h>
float addtwo (float a,float b);

{
  int z=1;
  int r=1;
  printf("the sum is %.2f",addtwo(z,r));
  }




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

1 Answer

Hi Muhammed,

This challenge is just looking for the implementation of the method - it doesn't want you to use it. So, what you've done is correct. My code looked different but yours is fine, just delete the rest of it:

float addTwo(float first, float second){
  return first + second;
}

Steve.

No problem!