About pointers

Posts 1–3 of 3 · Page 1 of 1
About pointers
Hello guys,


i'm learning C++ and i'm trying all my best to learn.

I have a little problem, here is it

Let's say i want to assign the value of an memory address (let's say a stamina hack)

I put
float * staminaadrs = 100;

but a friend told me that it's
*(float*)staminaadrs = 100;

I'm confused right now =S
I know something is wrong in my code because i'm declaring the adrs, i should not.
Sorry if this problem is "stupid" but i'm trying my best

thx (sorry for my bad english =S)
This only applies if you have direct access to the memory you're writing to. You're right, it does look something like that.

[php]
float* Address =(float*)0x12345678

*Address = 100;
[/php]

I hope you understand how pointers work.
pointers are painfull... at least they were for me when studying C (not c++).
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us