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
How is = symbol different from == symbol in c programming?
What is structure padding and packing in c?
Can we initialize extern variable in c?
What are the 5 types of organizational structures?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM
write a program to copy the string using switch case?
What are types of structure?
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.
What will the preprocessor do for a program?
How can variables be characterized?
What are logical errors and how does it differ from syntax errors?
How do you redirect a standard stream?
Write a program to print fibonacci series without using recursion?