@matrix sizeof just returns the size in bytes for type. It doesn't even evaluate the expression (unless VLA IIRC, don't quote me.) It just returns the size of the type of the expression.
uint32_t[10] is a type, uint32_t[11] is a different type. Hence why compiler knows this and can tell you this.
If you give it a a pointer, be it from malloc, cast, or you passed an array through function arg which is a pointer, it will lose that information (coz how the fuck would it know what you passed to a function at runtime)
so all it has to work with is size, in bytes, of pointer on your machine.
You got 2 coz you are on 64bit machine with 8byte pointers which you divide by sizeof int which is (usually) 4 bytes.
It just returns the size of the type of the expression.
uint32_t[10] is a type, uint32_t[11] is a different type. Hence why compiler knows this and can tell you this.
If you give it a a pointer, be it from malloc, cast, or you passed an array through function arg which is a pointer, it will lose that information (coz how the fuck would it know what you passed to a function at runtime)
so all it has to work with is size, in bytes, of pointer on your machine.
You got 2 coz you are on 64bit machine with 8byte pointers which you divide by sizeof int which is (usually) 4 bytes.
/sprg