how to calculate the size of this structure:
struct Node{
int data;
char b;
char *c;
};
when I run, it gives 16 bytes.
can anyone explain?
how to calculate the size of this structure:
struct Node{
int data;
char b;
char *c;
};
when I run, it gives 16 bytes.
can anyone explain?
how to calculate the size of this structure.
You cannot calculate it by hand without knowing which language implementation will be used, because the language doesn's specify it. If you do know the language implementation, then you may find the information in the documentation of that language implementation. Specifically, you should be looking for information on the Application Binary Interface (ABI).
You can use the sizeof
operator to get the size at compile time.