what is the use of #pragma pack, wer it is used?
Answers were Sorted based on User's Feedback
Answer / sarabjit kaur
#pragma is a miscelleneous directive which is used to turn
on or off certain features.
It varies frm compiler to compiler
a. #pragma startup and #pragma exit
used to specify which function should b called upon startup
(before main()) or program exit(just before program
terminates)
such funtions should nt receive or return any valur
b. #pragma -warn used to surpress specific warning
#pragma warn -rvl return value warnings surpressed
#pragma warn -par parameter not used warnings surpressed
#pragma warn -rch unreachable code warnings surpressed
Is This Answer Correct ? | 2 Yes | 3 No |
Answer / 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 |
simple program for virtual function?
Can we access RAM? How? Whats the range of access? Similarly What are other hardware we can access?
What is include directive in c?
void main() { int a=1; while(a++<=1) while(a++<=2); }
in a town the percentage of men is 52 the percentage of total literacy is 48 if total percentage of literate men is 35 of the total population write a program to find the total no of the literate men and women if the population of the town is 80000
Can we increase size of array in c?
write a program to display all prime numbers
What is the size of a union variable?
what is diff b/w huge & far & near pointer??
void main() { int x=25,y=32; clrscr(); x=x++ + y++; y=++x + ++y; printf("%d%d",x,y); }
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
read the folllowing code # define MAX 100 # define MIN 100 .... .... if(x>MAX) x=1; else if(x<MIN) x=-1; x=50; if the initial value of x=200,what is the vlaue after executing this code? a.200 b.1 c.-1 d.50