It would be a major security risk. That is why this kind of code produces segfault -
as for accessing harddrive in bytes, in Linux, assuming you have root priviledge, you can just open /dev/hda (or the name of your harddrive) in binary mode. I am not sure how one would do that in Windows.
a = 3;
Actually, on a second thought, it is possible on Linux too, to access physical memory. Just open /dev/mem in binary. Again, you will need root priviledge to do that. Not sure about Windows though.