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
What is boolean in c?
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.
Why ca not I do something like this?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.
how to find anagram without using string functions using only loops in c programming
What are header files why are they important?
What does printf does?
Explain output of printf("Hello World"-'A'+'B'); ?
Explain the term printf() and scanf() used in c language?
How can I write a function analogous to scanf?
Is there sort function in c?
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
How can I write functions that take a variable number of arguments?
Give the rules for variable declaration?