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 trialJeff Lever
292 PointsI've only been able to get a struct declaration to work if I fill it with float variables. Char doesn't work? Why?
I've tried using char variables in a struct declaration, but get the error "Incompatible pointer to integer conversion assigning to 'char' from 'char[2]'." So far, the only variables that work seem to be float. I haven't tried integers. When declaring struct variables, can you only popular it with numbers? Here's the code I attempted that wouldn't compile:
typedef struct { char make[3]; } car;
int main{ car favorites; favorites.make[0] = "Ford"; favorites.make[1] = "Toytoa";
printf("Favorite car makes: %c %c", favorite.make[0], favorite.make[1]); }
What am I doing wrong?