I use malloc(1024) to allocate a memory area of 1024 bytes. I can write a 8 bit variable to the pointer position. But If I write a 64 bit variable to the pointer position only 8 bit's are written.

My 64 bit variable value looks like this: F1F2F3F4F5F6F7F8
My 8 bit variable value looks like this: FF


If I write the 8 bit variable to memory it looks like this:

FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


If I write the 64 bit variable to memory it looks like this:

F1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


But I want the memory to look like this when my 64 bit variable is written:

F1 F2 F3 F4 F5 F6 F7 F8 00 00 00 00 00 00 00 00

After the 8 bit write I increase the pointer by 1, after the 64 bit write I increase the pointer by 8.

What am doing wrong here?

Can someone please help me with some example code?