How many cast can be used on void pointer
cast to void pointer
Collapse
This topic is closed.
X
X
-
puzzlecrackerTags: None -
Victor Bazarov
Re: cast to void pointer
puzzlecracker wrote:Infinitely many:How many cast can be used on void pointer
int main()
{
char const str[] = "abc";
void ptr = str;
while (true) // infinitely long
{
char const *pchar = static_cast<cha r const*>(prt);
}
}
The pointer when cast to another, does not degrade or affect the system.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
-
blargg
Re: cast to void pointer
In article
<aa4c069c-f880-4276-89ae-f6c39ccdd829@d7 0g2000hsc.googl egroups.com>,
puzzlecracker <ironsel2000@gm ail.comwrote:
As many as you can imagine (for practical purposes, infinite):How many cast can be used on void pointer
void* p = 0;
static_cast<cha r*(p);
static_cast<cha r**(p);
static_cast<Foo *(p);
static_cast<int (*) [1](p);
static_cast<int (*) [2](p);
etc.
Comment
Comment