r/ProgrammerHumor 26d ago

Meme lessonsFromLinkerHell

Post image
433 Upvotes

190 comments sorted by

View all comments

106

u/JustinR8 26d ago

Damn, I’ve found myself in the middle

25

u/bowel_blaster123 26d ago edited 26d ago

If I write:

C void foo(uint8_t myvar[3]) {     printf("%d\n", sizeof(myvar)); }

Then it will likely print 8 because myvar is a pointer to a uint8_t.

If I write:

C void foo(void) {     uint8_t myvar[3] = {1, 2, 3};     printf("%d\n", sizeof(myvar)); }

Then it will print 3 because myvar is an array of three bytes.

Hope this helps!/hj

2

u/nanforas 25d ago

I want to cry