c++ - (char *) (msg +1) where does this +1 takes us to? -
i seeing code, in have statement (char *)(emsg+1)
given,
i guess (char *) emsg
might have been string, + 1
here?
emsg
pointer type (e.g. int
). emsg + 1
increments pointer 1, i.e. points initial address + sizeof(int)
. then, (char*) (emsg + 1)
cast, i.e. end result casted char*
pointer, end pointer-to-char points initial address + sizeof(int)
.
in general, char*
pointers characters, i.e. c
-like 0 terminated strings, not case. convert pointer char*
when want "extract" smallest unit of addressable memory, on machines char*
pointer underlying type of 1 byte (char
).
Comments
Post a Comment