1

Is it allowed to have non-packed structure member inside a packed structure?

Something like this:

packed struct{
    int a;
    un-packed struct b;
    int c;
};

1 Answer 1

1

Yes, it is allowed. The unpacked structure is a normal type from the point of view of the compiler and the packeds structure will, technically, remain packed.

But, in a common sense, the packed structure will not be actually packed - there may be some bytes unused in the unpacked structure and hence in the packed structure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.