How to get allocate space for the struct player variable?
Code:
#include <stdio.h>
struct player {
int number;
int rank;
};
int main()
{
struct player variable = {35, 1};
struct player *ptr;
ptr = &variable;
printf("Meory Location of NUMBER: %p\n", &variable.number);
printf("Memory Location of RANK: %p \n", &variable.rank);
printf("NUMBER: %d\n", ptr->number);
printf("RANK: %d \n", ptr->rank);
printf("NUMBER: %d\n", (*ptr).number);
printf("RANK: %d \n", (*ptr).rank);
return 0;
}
Meory Location of NUMBER: 0061FF24
Memory Location of RANK: 0061FF28
NUMBER: 35
RANK: 1
NUMBER: 35
RANK: 1
Does it means 35 stored at location 0061FF24
Does it means 1 stored at location 0061FF28