Create an object at a given address: Difference between revisions

Content added Content deleted
(Forth)
(C)
Line 37: Line 37:
456
456
</pre>
</pre>

=={{header|C}}==
<lang c>#include <stdio.h>

int main()
{
int intspace;
int *address;

address = &intspace; // address = 0x100;
*address = 65535;
printf("%08x: %08x (=%08x)\n", address, *address, intspace);
// likely we must be worried about endianness, e.g.
*((char*)address) = 0x00;
*((char*)address+1) = 0x00;
*((char*)address+2) = 0xff;
*((char*)address+3) = 0xff; // if sizeof(int) == 4!
// which maybe is not the best way of writing 32 bit values...
printf("%08x: %08x (=%08x)\n", address, *address, intspace);
return 0;
}</lang>

<pre>bfc5675c: 0000ffff (=0000ffff)
bfc5675c: ffff0000 (=ffff0000)</pre>


=={{header|Forth}}==
=={{header|Forth}}==