what is the use of #pragma pack, wer it is used?
Answer Posted / ram
actually pragma pack is used for structure padding
we are having #pragma pack 0,#pragma pack 1,#pragma pack
2,#pragma pack 3,#pragma pack 4
in this first one will allocate memory 4 bytes for every
data type
in second one i.e in pack 1 it allocates 1 byte for every
data type
in third one i.e in pack 2 it allocates 2 bytes for every
data type
in fourth one i.e pack 3 it allocates 3 bytes for every data
type
in fifth one i.e pack 4 it allocates 4 bytes for every data type
Actually pragma will be used in powers of 2 only
Is This Answer Correct ? | 3 Yes | 10 No |
Post New Answer View All Answers
what will be maximum number of comparisons when number of elements are given?
What is structure padding in c?
What is structure and union in c?
Explain what are multidimensional arrays?
how to count no of words,characters,lines in a paragraph.
What are different storage class specifiers in c?
When is a “switch” statement preferable over an “if” statement?
What is the difference between new and malloc functions?
Write a program to print factorial of given number without using recursion?
What is the use of ?: Operator?
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
Explain about the constants which help in debugging?
What is a program?
What is c++ used for today?
What is the difference between #include