Sjmarf to Programmer Humor@programming.dev • 1 month agovoid *sh.itjust.worksimagemessage-square13fedilinkarrow-up1645arrow-down110
arrow-up1635arrow-down1imagevoid *sh.itjust.worksSjmarf to Programmer Humor@programming.dev • 1 month agomessage-square13fedilink
minus-square@neo@lemy.lollinkfedilink7•1 month 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 BelchlinkfedilinkEnglish5•1 month agoFor the void to point back at you just dereference the NULL pointer
minus-square@sus@programming.devlinkfedilink3•edit-21 month 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--; }