r/ProgrammerHumor 2d ago

Meme bugIntroducedDebugging

Post image
1.1k Upvotes

120 comments sorted by

View all comments

343

u/AdBrave2400 2d ago

Is the mistake that they're allocating 1 byte and storing in a pointer to an int which is 4 bytes?

1

u/mckenzie_keith 2d ago

x is a variable of type pointer to int. You can put x on the left side of a malloc() call. You can also free x. There is no bug up to that point.