3 ms·
> struct foo ptr = malloc(sizeof ptr); // should be sizeof ptr!! This is why whenever I use sizeof, I pass a type, not a variable.
by Sohcahtoa82 6y ago
> struct foo ptr = malloc(sizeof ptr); // should be sizeof ptr!!
This is why whenever I use sizeof, I pass a type, not a variable.