How to avoid structure padding in C?
Answer Posted / santosh
Packing, on the other hand prevents compiler from doing padding - this has to be explicitly requested - under GCC it's __attribute__((__packed__)), so the following:
struct __attribute__((__packed__)) mystruct_A {
char a;
int b;
char c;
};
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Explain a file operation in C with an example.
Describe the steps to insert data into a singly linked list.
What is the general form of function in c?
what is uses of .net
What is identifiers in c with examples?
The __________ attribute is used to announce variables based on definitions of columns in a table?
What is the purpose of main() function?
why return type of main is not necessary in linux
Here is a good puzzle: how do you write a program which produces its own source code as output?
What is sizeof array?
What are file streams?
Explain what are the different data types in c?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
What is a c token and types of c tokens?
What is masking?