A89: Re: Storing addresses to pointers
[Prev][Next][Index][Thread]
A89: Re: Storing addresses to pointers
> According to what I have read, you cannot store an immediate value (or any
> non-pointer variable) to a pointer variable. You can only copy pointers of
> the same type and such. Now, the books may say this, but, is there a way
to
> do this somehow? I was thinking something along the lines of
> "(long)address=0x001fca;" where address is a pointer to a char, but that
> simply doesn't look right. Could I do this using the asm(" command
somehow?
> Thanks.
No need to use assembly for this, just use cast. Here is a simple example :
long* pointer;
long number;
number = 0x12345;
pointer = (long*) number;
or, even more simple :
pointer = (long*) 0x12345;
References: