« first day (5 days earlier)
← previous day
last day (14 days later) »
Mooing Duck
00:03
@MohamedAhmedNabil what? Can you show me the cast you're confused about?
Mohamed Ahmed Nabil
if
int n
and i want to send the address of n as a char address
do i do this
(char)(n)
or this
(char*)(&n)
and why
Mooing Duck
@MohamedAhmedNabil
(char*)(&N)
@MohamedAhmedNabil
(char)(n)
will take
n
, and convert it to a char.
Mohamed Ahmed Nabil
and doesnt & change it to an address
oh the address itself wont be casted right?
Mooing Duck
(char*)(&N)
will take
N
, then take it's address
(&N)
so we have a pointer to an
int
, and then that pointer is converted to a pointer to
char
s
right,
(char)(n)
converts the
value
of
n
to a char, not the address. And it converts very very poorly.
Mohamed Ahmed Nabil
reinterpret_cast is better?
Mooing Duck
00:08
@MohamedAhmedNabil eh, in this case
(char*)(&N)
,
reinterpret_cast
and
static_cast
will do the same thing. In general, you should use one of the C++ casts, whichever is appropriate for your situation.
« first day (5 days earlier)
← previous day
last day (14 days later) »
all rooms
Transcript for
Aug
29
Aug '12
30
Sep
13
Room for Mohamed Ahmed Nabil and Mooi
…
join this room
about this room
00:00
06:00
12:00
18:00
all times are UTC
site design / logo © 2024 Stack Exchange Inc;
legal
mobile