I'm trying to typecast a struct
, with a pointer member, to (char *
). Please tell me if there is any difference between the below two typecasting strategies. The struct
is also shown.
struct videoPacket{
uchar * videoData;
}video;
// and initializing 'video' to some value
Strategy 1:
videoPacket * videoPointer = &video;
char * buffer = (char *)videoPointer;
Strategy 2:
videoPacket * videoPointer = &video;
char * buffer = (char *)videoPointer->videoData;
Since the struct
has a single member, will the buffer
not point to the same contents?
EDIT: If i want to typecast the struct shown below to char *, how do i do it?
struct struct1{
uchar * struct1data1;
char struct1data2;
}video;