5. main( )
{
int i = 25 ; int *j ;
float a = 3.14 ;
float *b ;
char far *kb ;
kb = 0x417 ;
j = &i ;
b = &a ;
}
Why far and near
6. i a j b kb
25 3.14 200 300
200 300
0x417
Code Segment
Turbo C
DOS/Windows
BDA 0x417
IVT
0xB8000000
Screen
M A
0xB8000000
M
A B C D E F
384 KB
High Memory
640 KB
Base or
Conventional
Memory
Data
Segment
Free Memory
(640 + 64 ) * 1024
HEX
64 * 6
7. main( )
{
Pointer Sizes
int i = 25 ; int *j ;
float a = 3.14 ;
float *b ;
char far *kb ;
kb = 0x417 ;
j = i ;
b = a ;
}
2 2
printf ( ”%d %d %d”, sizeof ( j ), sizeof ( b ),
sizeof ( kb ) ) ;
4
8. How Much Memory
main( )
{
int far *m ;
m = 0x413 ;
printf ( ”%d” ,*m ) ;
} 0x413 0x414
640
640 KB
BDA
Ideally
632
634
636
?
9. main( )
{
int a = 10, b = 20 ;
printf ( ”%d%d”, a, b ) ;
swapv ( a , b ) ;
printf ( ”%d%d”, a, b ) ;
}
swapv ( int x, int y )
{
}
int t ;
t = x ; x = y ; y = t ;
printf ( ”%d%d”, x, y ) ;
10 20
10 20
a b
x y t
x y t
x y t
x y t
10 20 g
10 20 10
20 20 10
20 10 10
20 10
10 20
10. swapr ( a , b ) ;
printf ( ”%d%d”, a, b ) ;
swapr ( )
{
}
int t ;
t = *x ;
*x = *y ;
*y = t ;
10 20
20 10
a b
20
20 10
300
x y t
main( )
{
int a = 10, b = 20 ;
printf ( ”%d%d”, a, b ) ;
int *x , int *y 200 } 10
200 300 10
11. main( )
{
int a = 10, b = 20, c = 30
sumprod ( a, b, c, ) ;
printf ( ”%d%d”, s, p ) ;
}
, s, p ;
60 6000
sumprod ( int x, int y, int z, )
{
}
x + y + z ;
x * y * z ;
s, p
int *ss, int*pp
ss =
pp =
*
*
a b c s p
6G0 60G00
100 200
10 20 30
x y z ss pp
10 20 30 100 200
12. Advanced Features of
Functions
• Returning Non-integer Value
• Call By Value / Reference
• Recursion
13. To Be A Successful Software
Developer
Creative Intelligence
Analytical Ability
Patience
Ability To Think