Friday, February 8, 2008

memory model

(2)How many pointers are in turbo C?
Ans:
3
1. Near pointer (16 bit)
2. Far pointer (32 bit)
3. Huge pointer (32 bit)
(3) How many memory models?
Ans:
According to size of program in code area,data area and stack area there are six type of memory model:
1. Tiny
2. Small (default)
3. Medium
4. Compact
5. Large
6. Huge

Note: - to change memory model (in turbo c) go to
Option->compiler->code generation.
(1) What will output :

Void main()
{
int * p,b;
b=sizeof(p);
printf("%d",b);
}
Ans:
Output: 2 or 4
Explanation:
Since in this question it has not written p is which type pointer.So it's output will depends upon which memory model has selected. Default memory model is small.
Memory model...............................................default pointer size

Tiny, Small (default), Medium near...................................2
Compact,Large,Huge far......................................................4

 

0 comment here::