0

This is an structure question I'm stuck at this

https://code.sololearn.com/cV0PQrHzhPqc/?ref=app In this output Should be 8 as pointer size can be 4 but why it's 16 and returning long range resultant value Can you guys give me some insight about this code. Does pointer size differ in any way

20th Sep 2020, 2:36 PM
Sanaya Singhaniya
Sanaya Singhaniya - avatar
1 Réponse
+ 2
Sanaya, We should always rely on `sizeof` operator when it comes to finding the size of a certain data type. The struct carries a char pointer, then you have an array of the struct in main function, since the array has two elements, that roughly means sizeof(struct students) multiplied by two (number of array elements).
20th Sep 2020, 4:06 PM
Ipang