Hi,
I'm trying to use static_cast for dynamic allocation of a structure.
Here is my code
struct storage
{
char mychar;
int myint;
storage* next;
storage* prev;
} store;
int main(void)
{
// newstore points to the new structure storage
storage* newstore = static_cast<storage*>new(sizeof(storage));
return 0;
}
The compiler returns the following error:
"parse error before new"
In (Microsoft ) C++, how do I use static_cast in this application?
Thanks in advance,
John
I'm trying to use static_cast for dynamic allocation of a structure.
Here is my code
struct storage
{
char mychar;
int myint;
storage* next;
storage* prev;
} store;
int main(void)
{
// newstore points to the new structure storage
storage* newstore = static_cast<storage*>new(sizeof(storage));
return 0;
}
The compiler returns the following error:
"parse error before new"
In (Microsoft ) C++, how do I use static_cast in this application?
Thanks in advance,
John