Weird pointer interaction... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Weird pointer interaction...

Since my memory reader code somehow worked I have been wondering how the operating system protects its memory. So I changed the code and found out that not all memory cells I wanted to read from were displayed by printf. Obviously only very few parts of the memory (you haven't overwritten on your own) are readable. And while I was still testing I found the alphabet by accident. P.S. Can someone explain this? https://code.sololearn.com/cb5UdgJlCvc9/?ref=app https://code.sololearn.com/c7wSEHuzfFzN/?ref=app

31st Jan 2018, 8:33 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
1 Answer
+ 2
Meanwhile I found out following points: 1. Usually you can't read from a pointer even if your program "owns" its address until you overwrite it 2. Still some bytes may be readable but never writable 3. On SL these bytes have always some special value, for example the alphabet. On my Linux PC the Memory Reader Code would result in garbage or a memory error 4. SL seems to always store the same additional readable data in a programs virtual address space (maybe because of the OS or the compiler I suggest)
1st Feb 2018, 7:10 PM
Aaron Eberhardt
Aaron Eberhardt - avatar