This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can pointer types be cast?

Here is my problem, i have several simmilar structue definitions (containers for messages)

struct FIRST{
unsigned char Word_Pos[8]
unsigned char Data[8]
unsigned char Msg_Len
};
struct FIRST A

struct SECOND{
unsigned char Word_Pos[4]
unsigned char Data[4]
unsigned char Msg_Len
};
struct SECOND B

struct THIRD{
unsigned char Word_Pos[10]
unsigned char Data[10]
unsigned char Msg_Len
};
struct THIRD C

Is there a way to declare single pointer (lets say "P") such that i will be able to point to each of these structures so i can transparently use:
P->Word_Pos []
P->Data []
P->MSG_Len in my ISR.

I realise i could just declare 3 structures of type THIRD and just use one pointer easily, but in my actual application there will be many of these simmilar but different structures and i am trying to save ram.

0