I am attempting to fill in a struct I have created in C, and for whatever reason it is not being reflected when I set a struct's parameters to 0. What am I doing wrong?
Here is the code:
struct Quad head_Quad, *temp_Quad;
head_Quad.ll_x = 0.0;
head_Quad.ll_y = 0.0;
head_Quad.side_length = 600;
temp_Quad = &head_Quad;
printf("head quad length: %d \n", head_Quad.side_length);
printf("temp quad length: %d \n", temp_Quad->side_length);
The printf is giving me 0. (temp was just an attempt to test if the value was set again)
Below is the struct itself:
typedef struct Quad
{
double ll_x; //lower left x point
double ll_y; //lower left y point
double side_length;
}Quad;
-Wallwill do that. If you're using GCC, add-Wall -Wextra -Werrorto your command line.