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


Please Help Members By Posting Answers For Below Questions

Can main () be called recursively?

640


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

639


How can I discover how many arguments a function was actually called with?

644


any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()

703


to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?

1581






Explain Basic concepts of C language?

654


How do you define a function?

594


Can the size of an array be declared at runtime?

623


Explain Function Pointer?

693


How to find a missed value, if you want to store 100 values in a 99 sized array?

825


Explain how can I prevent another program from modifying part of a file that I am modifying?

650


Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer

3852


How does struct work in c?

619


What is adt in c programming?

627


What is difference between scanf and gets?

622