Hofmaimaier@feddit.org to Programmer Humor@programming.dev · 3 days agoultra casualimagemessage-square39linkfedilinkarrow-up1432arrow-down115
arrow-up1417arrow-down1imageultra casualHofmaimaier@feddit.org to Programmer Humor@programming.dev · 3 days agomessage-square39linkfedilink
minus-squareA_norny_mousse@piefed.ziplinkfedilinkEnglisharrow-up9·3 days agoint personality = sizeof(goals); Feels a bit simplified to me.
minus-squareChaoticNeutralCzech@feddit.orglinkfedilinkEnglisharrow-up6·3 days agoYou are correct, that is simplified. The whole line is int personality = sizeof(goals) / sizeof(goals[0]); To get the length of an array in C, it’s necessary to divide its memory footprint by the size of a single element! BTW you can see what appears to be ASCII in the background of that image. You can decode it if you’re bored.
int personality = sizeof(goals);
Feels a bit simplified to me.
You are correct, that is simplified. The whole line is
int personality = sizeof(goals) / sizeof(goals[0]);To get the length of an array in C, it’s necessary to divide its memory footprint by the size of a single element!
BTW you can see what appears to be ASCII in the background of that image. You can decode it if you’re bored.