3 ms·
> If a value is stored into an object having no declared type through an lvalue having a type that is not a character type, then the type of the lvalue becomes
by gizmo686 1y ago
> If a value is stored into an object having no declared
type through an lvalue having a type that is not a character type,
then the type of the lvalue becomes the effective type of the object
for that access and for subsequent accesses that do not modify the
stored value
As I read it, this means that
struct foo *x = malloc(sizeof(*x))
Will have an effective type of "struct foo*", which seems like what you would expect.
- eddd-ddde 1y agoBut if then you write to that memory through a int pointer the effective type is int. Unlike if you would have allocated the struct in the stack.