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 trialSebastian Nitu
8,616 PointsWhy does Xcode ask me for ";"?
Hello, I am pretty much certain that I am the one coins something wrong here but I cannot explain myself why is Xcode prompting me with the error in this screenshot.
I am starting to think that programming might not be for me...
7 Answers
Amit Bijlani
Treehouse Guest TeacherJust as John W mentioned:
#include <stdio.h>
typedef struct {
float center[3];
float radius;
} Sphere;
Sphere makeSphere (float *c, float r);
int main()
{
}
Sphere makeSphere (float *c, float r)
{
Sphere sphere;
sphere.center[0] = *c[0];
sphere.center[1] = *c[1];
sphere.center[2] = *c[2];
sphere.radius = r;
return Sphere;
}
Natacha S
11,561 Pointsyes you are just missing ; at the end of the statement !
John W
21,558 PointsYou are trying to define a function inside a function. Just move the whole thing outside of main() and it should fix it.
Vikram Pal
Courses Plus Student 307 PointsJust put a " ; " at the end, does it go away?
Sebastian Nitu
8,616 PointsI believe the construct itself shouldnt have a ";" and if a do put a ";" it invalidarea everything beneath. In the example from the video, there is no ";" before opening the querly braces
Sebastian Nitu
8,616 PointsAmit Bijlani , Any ideas?
Fuad Adetoro
6,490 Pointstry this
#include <stdio.h>
typedef struct {
float center[3];
float radius;
} Sphere;
Sphere makeSphere (float *c, float r);
int main()
{
}
Sphere makeSphere (float *c, float r)
{
Sphere sphere;
sphere.center[0] = *c[0];
sphere.center[1] = *c[1];
sphere.center[2] = *c[2];
sphere.radius = r;
}