Sjmarf to Programmer Humor@programming.dev · 7 months agovoid *imagemessage-square13fedilinkarrow-up1643arrow-down110
arrow-up1633arrow-down1imagevoid *Sjmarf to Programmer Humor@programming.dev · 7 months agomessage-square13fedilink
minus-squareneo@lemy.lollinkfedilinkarrow-up7·7 months agoSo, when I want the void to point back at me, do I have to loop over void* or over NULL? And how many iterations?
minus-squareProgrammer Belch@lemmy.dbzer0.comlinkfedilinkEnglisharrow-up7·7 months agoFor the void to point back at you just dereference the NULL pointer
minus-squaresus@programming.devlinkfedilinkarrow-up3·edit-27 months agoas many iterations as it takes void* x = &x; char* ptr = (char*)&x; while (1) { printf("%d\n", (unsigned int)*ptr); ptr--; }
So, when I want the void to point back at me, do I have to loop over void* or over NULL?
And how many iterations?
For the void to point back at you just dereference the NULL pointer
as many iterations as it takes
void* x = &x; char* ptr = (char*)&x; while (1) { printf("%d\n", (unsigned int)*ptr); ptr--; }