Cipherd@lemmy.ml to Programmer Humor@programming.dev · 2 days agofunctionslemmy.mlimagemessage-square119fedilinkarrow-up1645arrow-down19file-textcross-posted to: [email protected]
arrow-up1636arrow-down1imagefunctionslemmy.mlCipherd@lemmy.ml to Programmer Humor@programming.dev · 2 days agomessage-square119fedilinkfile-textcross-posted to: [email protected]
minus-squareZiglin (it/they)@lemmy.worldlinkfedilinkEnglisharrow-up2·2 days agoOr perhaps call function if you’ve got a call stack going. Nevermind that is C or something right? Otherwise it would be jmp function?
minus-squarex00z@lemmy.worldlinkfedilinkEnglisharrow-up2·2 days agoYeah that’s C. I added the goto to put emphasis on the function being a label instead of a real function. https://www.geeksforgeeks.org/c/goto-statement-in-c/
minus-squareZiglin (it/they)@lemmy.worldlinkfedilinkEnglisharrow-up1·1 day agoI’ve done that in C before. I was just confused because the labels need to be in scope of a function as far as I am aware. In assembly you don’t really have that.
minus-squarex00z@lemmy.worldlinkfedilinkEnglisharrow-up1·1 day agoWe’ll just put everything in int main(). No worries
function: ... goto function;Or perhaps
call functionif you’ve got a call stack going.Nevermind that is C or something right? Otherwise it would be
jmp function?Yeah that’s C.
I added the
gototo put emphasis on the function being a label instead of a real function.https://www.geeksforgeeks.org/c/goto-statement-in-c/
I’ve done that in C before. I was just confused because the labels need to be in scope of a function as far as I am aware. In assembly you don’t really have that.
We’ll just put everything in
int main(). No worries