Hello all
How do I assign a variable to a specific memory address?
Hello all
How do I assign a variable to a specific memory address?
Code:int address = 1000; int * ptr = (int*)address; *ptr = 175; //... cross fingers :D ...
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
heheheOriginally posted by Sebastiani
Code:int address = 1000; int * ptr = (int*)address; *ptr = 175; //... cross fingers :D ...
You could just do this:
But you shouldn't be doing this anyway. I saw this exact question on the boards earlier. Doing this is not a good idea if you don't know what you are doing. By virtue of the fact that you don't know how to do this I'd say that you shouldn't be doing this sort of thing.Code:int *ptr = (int *)02400000; //yes this is an octal number, I never use them. *ptr = ~*ptr; // Should be in the video card range somewhere.
>>*ptr = ~*ptr;
What is this line used for, is the ~ the compliment.
So how does it work?
Last edited by ammar; 12-10-2002 at 04:48 AM.
none...
>>I saw this exact question on the boards earlier.
http://www.cprogramming.com/cboard/s...threadid=30224
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
What's the difference betwem
andCode:int address = 1000; int *ptr = (int*)address;
- It may be because I haven't yet used CAST, but please explain.Code:int address = 1000; int *ptr = address;
*EDIT*
Furthermore I don't get what the point is about this:
int *ptr = (int *)02400000;
Last edited by Zahl; 12-10-2002 at 08:44 AM.
Well english isn't my first language, (it's instead a useless language called danish which only 5 milion people speak!!) so if you think my grammar SUCKS (it does by the way) than you're more then welcome to correct me.
Hell I might even learn something