I want to know what a struct type variable represents in C, I understand that a variable of type int is referring to an integer value in the memory and I can use that integer variable to do multiple sorts of things like add, subtract, etc..., And I understand that an array variable represents an address to the first element in that array.
But what about the struct type variable, what does it refer to (I know it is not a pointer and it is used to access struct members)?
To explain the problem in more detail, in the example below you can see that the address of the birthDate variable which is of type struct date is the same as the address of the first member in the birthDate variable.
But the variable itself seems to store some sort of address as you can see, my question is what does this value (might be an address) stored in the struct variable birthDate represent?
#include <stdio.h>
int main()
{
struct date
{
int day;
int month;
int year;
};
struct date birthDate = { 7, 12, 1999 };
printf("birthDate variable address => %p\n\n", (void*) &birthDate);
printf("birthDate variable first member address => %p\n\n", (void*) &birthDate.day);
printf("The struct type birthDate variable value ( which seems to be an address or something :\\ ) => %i (int), %0X (hex)\n\n", birthDate, birthDate);
int x = 2;
printf("The interger x variable value ( cool I understand this :) ) => %i\n", x);
return 0;
}
Output
birthDate variable address => 000000000061FE10
birthDate variable first member address => 000000000061FE10
The struct type birthDate variable value ( which seems to be an address or something :\ ) => 6422016 (int), 61FDF0 (hex)
The interger x variable value ( cool I understand this :) ) => 2