1. ## Memory Addresses

Hello all
How do I assign a variable to a specific memory address?

2. Code:
``` int address = 1000;
int * ptr = (int*)address;
*ptr = 175; //... cross fingers :D ...```

3. Originally posted by Sebastiani
Code:
``` int address = 1000;
int * ptr = (int*)address;
*ptr = 175; //... cross fingers :D ...```
hehehe

4. You could just do this:

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.```
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.

5. >>*ptr = ~*ptr;
What is this line used for, is the ~ the compliment.
So how does it work?

6. >>I saw this exact question on the boards earlier.

7. What's the difference betwem
Code:
```int address = 1000;
int *ptr = (int*)address;```
and
Code:
```int address = 1000;
int *ptr = address;```
- It may be because I haven't yet used CAST, but please explain.

*EDIT*

Furthermore I don't get what the point is about this:
int *ptr = (int *)02400000;

Popular pages Recent additions