Value in struct exhibiting odd behavior

Howdy all,

I'm working on my own library for the mcp2515. In it, i'm using this structure;

typedef struct {
uint8_t isExtended;
uint32_t address;
uint8_t data[8];
uint8_t rtr;
} canmsg;

to test it, i have a main with following lines of code

canmsg* msg;
msg->isExtended = 0x00;
Serial.println(msg->isExtended);
Serial.println("Initial Value:");
Serial.println(msg->isExtended);

This is where it gets weird, as it prints

0
Initial Value:
255

Which seemingly modifies the value of msg->isExtended as soon as some other instruction is executed.
However, if I rearrange the definitions in the struct so that is now

typedef struct {
uint32_t address;
uint8_t data[8];
uint8_t rtr;
uint8_t isExtended;
} canmsg;

and the run the main again; I'm getting

0
intial value:
0

Why on earth does this happen?

canmsg* msg; //<--------------------pointing to random location if this is a local variable
//<--------------------if global it must be a NULL pointer
//<--------------------You must allocate or assign this pointer to some valid location
canmsg myVar;
msg=&myVar; //Assign the valid location
msg->isExtended = 0x00; // Now you can use this variable
Serial.println(msg->isExtended);
Serial.println("Initial Value:");
Serial.println(msg->isExtended);