Structure members order: char a; int b; char c; double d;
Size using sizeof() = 24 bytes
#include <stdio.h>
struct Example {
char a; // 1 byte
int b; // 4 bytes
char c; // 1 byte
double d; // 8 bytes
};
int main() {
printf("Size of structure = %lu bytesn", sizeof(struct Example));
return 0;
}
#include <stdio.h>
struct Example {
char a; // 1 byte
int b; // 4 bytes
char c; // 1 byte
double d; // 8 bytes
};
int main() {
printf("Size of structure = %lu bytesn", sizeof(struct Example));
return 0;
}