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 trialAbraham Orellanes
1,599 PointsWhat is happening in the 'implementation' section?
Why do you have to assign 'c' to center. Why can't you just use 'center' already defined in the interface section?
So instead of doing:
float c[]= {1, 2, 3};
you could do:
float center[]={1,2,3};
and you wouldn't need the lines:
sphere.center[0]=c[0]; ...
1 Answer
Shani Rivers
14,920 PointsThe reason why you need to pass c[0] to sphere.center[0] is because you are passing or pointing to the address of the data at the location of c[0], which is of value 1. If you try to pass the data (of format float with a value of 1), you will get an error message due to the fact that it is not an address in memory, you are passing an array to the function *c, not a float value.