Writing data to a location in memory

So I am working on an assembly language program that gets input from the user and writes it to a buffer in memory. But first, I gotta write a higher level language program that accomplishes the same.

In assembly, we can use the store byte (sb) instruction. What about c++? Is there something analogues to sb in c++?

Last edited on
I think what your looking for a is a void pointer: void* a;.

This lets you set an address for an object which doesn't necessarily correspond to a type. Then you can unpack it however you like. Maybe someone else can elaborate for you.

The problem with writing to a space in memory defined by a void pointer is that I think the language has problems defining how much memory to reserve.
If you want a direct analogy to storing a single byte, in C++ a char is defined to be one byte.

1
2
char* someWhereInMemory = (char*) 0xFEEDFACE; // Where 0xFEEDFACE is a memory location
*someWhereInMemory = someChar;
Topic archived. No new replies allowed.