SlideShare une entreprise Scribd logo
1  sur  13
What would be the output 
main( ) 
{ 
int i = 10 ; float a = 3.14 ; char ch = ’z’ ; 
j = &i ; b = &a ; dh = &ch ; 
k = &j ; c = &b ; eh = &dh ; 
printf ( ” %d %d %d 
” , j , b , dh ) ; 
printf ( ” ” , *k ,*c , *eh ) ; 
%d %d %d 
i 
a ch 
j b dh 
4000 5000 6000 
4000 5000 6000 
500 1500 2500 
1000 2000 3000 
printf ( ” ” , sizeof ( i ), sizeof ( a ), sizeof ( ch ) ) ; 
%d %d %d 
10 
3.14 z 
1000 2000 3000 
1000 2000 3000 
k c eh 
1000 2000 3000 
2 4 1 
CCoonnttiinnuueedd...... 
int *j, **k ; float *b, **c ; char *dh, **eh ;
i 
a ch 
j b dh 
4000 5000 6000 
4000 5000 6000 
500 1500 2500 
2 2 2 
printf ( ”%d %d %d ”, sizeof ( j ), sizeof ( b ), sizeof ( dh ) ) ; 
printf ( ”%d %d %d”, sizeof ( k ), sizeof ( c ), sizeof ( eh ) ) ; 
printf ( ”%d %f %c” , **k, **c, **eh ) ; 
} 
10 
3.14 z 
1000 2000 3000 
1000 2000 3000 
k c eh 
2 2 2 
10 3.14 z 
......CCoonnttiinnuueedd
Truly Speaking 
main( ) 
{ 
int i = 25 ; 
float a = 3.14 ; 
j = &i ; 
int *j ; 
float *b ; 
b = &a ; 
} 
printf ( ”%d%f”, *j, *b ) ; 
i 
Binary of 25 401 
401 402 
a 
501 502 503 504 
j 
b 
Binary of 3.14 501
Accessing Individual Bytes 
a 
main( ) 
{ 
float a = 3.14 ; 
501 
502 
float *b ; int *c ; char *d ; 
b c d 
b = &a ; 
c = &a ; 
d = &a ; 
printf ( ” %f %d %d 
”, *b, *c, *d ) ; 
printf ( ”%d %d %d %d”, *d, *(d+1), *(d+2), *(d+3) ) ; 
printf ( ”%d %d”, *( c+1 ), *( c+2 ) ) ; 
} 
503 504 
501 
0’s & 
1’s 
0’s & 
1’s 
0’s & 
1’s 
0’s & 
1’s 
501 
501
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
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
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
How Much Memory 
main( ) 
{ 
int far *m ; 
m = 0x413 ; 
printf ( ”%d” ,*m ) ; 
} 0x413 0x414 
640 
640 KB 
BDA 
Ideally 
632 
634 
636 
?
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
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
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
Advanced Features of 
Functions 
• Returning Non-integer Value 
• Call By Value / Reference 
• Recursion
To Be A Successful Software 
Developer 
Creative Intelligence 
Analytical Ability 
Patience 
Ability To Think

Contenu connexe

Tendances

Yohan jacobi gaussseidel_analisis
Yohan jacobi gaussseidel_analisisYohan jacobi gaussseidel_analisis
Yohan jacobi gaussseidel_analisisYohan Sidik
 
6.1 Шаблоны классов
6.1 Шаблоны классов6.1 Шаблоны классов
6.1 Шаблоны классовDEVTYPE
 
Tomografi Delay Time Sederhana
Tomografi Delay Time SederhanaTomografi Delay Time Sederhana
Tomografi Delay Time SederhanaFajar Perdana
 
(Meta 4) ejemplo calcular la mitad de un numero dev c++
(Meta 4) ejemplo calcular la mitad de un numero dev c++ (Meta 4) ejemplo calcular la mitad de un numero dev c++
(Meta 4) ejemplo calcular la mitad de un numero dev c++ Eli Diaz
 
C - Pattern - Code - [Future Programming]
C - Pattern - Code - [Future Programming]C - Pattern - Code - [Future Programming]
C - Pattern - Code - [Future Programming]Future Programming
 
Pruebabfs
PruebabfsPruebabfs
PruebabfsJorge
 
Tugas alpro 3.3
Tugas alpro 3.3Tugas alpro 3.3
Tugas alpro 3.31300018047
 
Cg lab cse-vii
Cg lab cse-viiCg lab cse-vii
Cg lab cse-viisajjan93
 
contoh Program C++ tentang fungsi for
contoh Program C++ tentang fungsi forcontoh Program C++ tentang fungsi for
contoh Program C++ tentang fungsi forM Fahmi Ansori
 
CM 1.3a MrG Functions, Domain, Range
CM 1.3a MrG Functions, Domain, RangeCM 1.3a MrG Functions, Domain, Range
CM 1.3a MrG Functions, Domain, RangeA Jorge Garcia
 

Tendances (20)

Daniel snake
Daniel snakeDaniel snake
Daniel snake
 
NME1
NME1NME1
NME1
 
Yohan jacobi gaussseidel_analisis
Yohan jacobi gaussseidel_analisisYohan jacobi gaussseidel_analisis
Yohan jacobi gaussseidel_analisis
 
python-geohex
python-geohexpython-geohex
python-geohex
 
Los fantastico
Los fantasticoLos fantastico
Los fantastico
 
Manual de practicas
Manual de practicasManual de practicas
Manual de practicas
 
6.1 Шаблоны классов
6.1 Шаблоны классов6.1 Шаблоны классов
6.1 Шаблоны классов
 
National Association of Christian Ministers
National Association of Christian MinistersNational Association of Christian Ministers
National Association of Christian Ministers
 
Tomografi Delay Time Sederhana
Tomografi Delay Time SederhanaTomografi Delay Time Sederhana
Tomografi Delay Time Sederhana
 
(Meta 4) ejemplo calcular la mitad de un numero dev c++
(Meta 4) ejemplo calcular la mitad de un numero dev c++ (Meta 4) ejemplo calcular la mitad de un numero dev c++
(Meta 4) ejemplo calcular la mitad de un numero dev c++
 
C - Pattern - Code - [Future Programming]
C - Pattern - Code - [Future Programming]C - Pattern - Code - [Future Programming]
C - Pattern - Code - [Future Programming]
 
Pruebabfs
PruebabfsPruebabfs
Pruebabfs
 
Aman
AmanAman
Aman
 
Tugas alpro 3.3
Tugas alpro 3.3Tugas alpro 3.3
Tugas alpro 3.3
 
Cg lab cse-vii
Cg lab cse-viiCg lab cse-vii
Cg lab cse-vii
 
contoh Program C++ tentang fungsi for
contoh Program C++ tentang fungsi forcontoh Program C++ tentang fungsi for
contoh Program C++ tentang fungsi for
 
Linker
LinkerLinker
Linker
 
Kasus 3.3 akar
Kasus 3.3 akarKasus 3.3 akar
Kasus 3.3 akar
 
CM 1.3a MrG Functions, Domain, Range
CM 1.3a MrG Functions, Domain, RangeCM 1.3a MrG Functions, Domain, Range
CM 1.3a MrG Functions, Domain, Range
 
Md5
Md5Md5
Md5
 

En vedette (18)

STACKS AND QUEUES CONCEPTS
STACKS AND QUEUES CONCEPTSSTACKS AND QUEUES CONCEPTS
STACKS AND QUEUES CONCEPTS
 
List build linked in - jigsaw - salesforce - free tools
List build   linked in - jigsaw - salesforce - free toolsList build   linked in - jigsaw - salesforce - free tools
List build linked in - jigsaw - salesforce - free tools
 
B-TREE PREPARED BY M V BRAHMANANDA REDDY
B-TREE PREPARED BY M V BRAHMANANDA REDDYB-TREE PREPARED BY M V BRAHMANANDA REDDY
B-TREE PREPARED BY M V BRAHMANANDA REDDY
 
Vcs8
Vcs8Vcs8
Vcs8
 
Vcs23
Vcs23Vcs23
Vcs23
 
Vcs9
Vcs9Vcs9
Vcs9
 
Vcs29
Vcs29Vcs29
Vcs29
 
C languaGE UNIT-1
C languaGE UNIT-1C languaGE UNIT-1
C languaGE UNIT-1
 
Vcs4
Vcs4Vcs4
Vcs4
 
Gincana
GincanaGincana
Gincana
 
Presentation Ukay Metal Ind.Pvt.Ltd.-Ashok 7-2015
Presentation Ukay Metal Ind.Pvt.Ltd.-Ashok  7-2015Presentation Ukay Metal Ind.Pvt.Ltd.-Ashok  7-2015
Presentation Ukay Metal Ind.Pvt.Ltd.-Ashok 7-2015
 
Presentation ukay 2014 - ashok 05.2014
Presentation ukay 2014 - ashok  05.2014Presentation ukay 2014 - ashok  05.2014
Presentation ukay 2014 - ashok 05.2014
 
Presentation ukay ashok 2-2015
Presentation ukay  ashok  2-2015Presentation ukay  ashok  2-2015
Presentation ukay ashok 2-2015
 
C SLIDES PREPARED BY M V B REDDY
C SLIDES PREPARED BY  M V B REDDYC SLIDES PREPARED BY  M V B REDDY
C SLIDES PREPARED BY M V B REDDY
 
Vcs26
Vcs26Vcs26
Vcs26
 
Presentation ukay 2014 - ashok 17.02.2014
Presentation ukay 2014 - ashok  17.02.2014Presentation ukay 2014 - ashok  17.02.2014
Presentation ukay 2014 - ashok 17.02.2014
 
C PROGRAMS
C PROGRAMSC PROGRAMS
C PROGRAMS
 
RIM(Reaction Injection Moulding)
RIM(Reaction Injection Moulding)RIM(Reaction Injection Moulding)
RIM(Reaction Injection Moulding)
 

Plus de Malikireddy Bramhananda Reddy

DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYDATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYMalikireddy Bramhananda Reddy
 
DATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDY
DATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDYDATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDY
DATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDYMalikireddy Bramhananda Reddy
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyMalikireddy Bramhananda Reddy
 
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
C notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit orderC notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit order
C notes by m v b reddy(gitam)imp notes all units notes 5 unit orderMalikireddy Bramhananda Reddy
 

Plus de Malikireddy Bramhananda Reddy (20)

M v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notesM v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notes
 
AVL TREE PREPARED BY M V BRAHMANANDA REDDY
AVL TREE PREPARED BY M V BRAHMANANDA REDDYAVL TREE PREPARED BY M V BRAHMANANDA REDDY
AVL TREE PREPARED BY M V BRAHMANANDA REDDY
 
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYDATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
 
DATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDY
DATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDYDATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDY
DATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDY
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
 
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDYC LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
 
DATASTRUCTURES UNIT-1
DATASTRUCTURES UNIT-1DATASTRUCTURES UNIT-1
DATASTRUCTURES UNIT-1
 
Data representation UNIT-1
Data representation UNIT-1Data representation UNIT-1
Data representation UNIT-1
 
C AND DATASTRUCTURES PREPARED BY M V B REDDY
C AND DATASTRUCTURES PREPARED BY M V B REDDYC AND DATASTRUCTURES PREPARED BY M V B REDDY
C AND DATASTRUCTURES PREPARED BY M V B REDDY
 
C LANGUAGE NOTES
C LANGUAGE NOTESC LANGUAGE NOTES
C LANGUAGE NOTES
 
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
C notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit orderC notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit order
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
 
Vcs28
Vcs28Vcs28
Vcs28
 
Vcs24
Vcs24Vcs24
Vcs24
 
Vcs22
Vcs22Vcs22
Vcs22
 
Vcs21
Vcs21Vcs21
Vcs21
 
Vcs20
Vcs20Vcs20
Vcs20
 
Vcs19
Vcs19Vcs19
Vcs19
 
Vcs17
Vcs17Vcs17
Vcs17
 
Vcs16
Vcs16Vcs16
Vcs16
 
Vcs15
Vcs15Vcs15
Vcs15
 

Vcs12

  • 1. What would be the output main( ) { int i = 10 ; float a = 3.14 ; char ch = ’z’ ; j = &i ; b = &a ; dh = &ch ; k = &j ; c = &b ; eh = &dh ; printf ( ” %d %d %d ” , j , b , dh ) ; printf ( ” ” , *k ,*c , *eh ) ; %d %d %d i a ch j b dh 4000 5000 6000 4000 5000 6000 500 1500 2500 1000 2000 3000 printf ( ” ” , sizeof ( i ), sizeof ( a ), sizeof ( ch ) ) ; %d %d %d 10 3.14 z 1000 2000 3000 1000 2000 3000 k c eh 1000 2000 3000 2 4 1 CCoonnttiinnuueedd...... int *j, **k ; float *b, **c ; char *dh, **eh ;
  • 2. i a ch j b dh 4000 5000 6000 4000 5000 6000 500 1500 2500 2 2 2 printf ( ”%d %d %d ”, sizeof ( j ), sizeof ( b ), sizeof ( dh ) ) ; printf ( ”%d %d %d”, sizeof ( k ), sizeof ( c ), sizeof ( eh ) ) ; printf ( ”%d %f %c” , **k, **c, **eh ) ; } 10 3.14 z 1000 2000 3000 1000 2000 3000 k c eh 2 2 2 10 3.14 z ......CCoonnttiinnuueedd
  • 3. Truly Speaking main( ) { int i = 25 ; float a = 3.14 ; j = &i ; int *j ; float *b ; b = &a ; } printf ( ”%d%f”, *j, *b ) ; i Binary of 25 401 401 402 a 501 502 503 504 j b Binary of 3.14 501
  • 4. Accessing Individual Bytes a main( ) { float a = 3.14 ; 501 502 float *b ; int *c ; char *d ; b c d b = &a ; c = &a ; d = &a ; printf ( ” %f %d %d ”, *b, *c, *d ) ; printf ( ”%d %d %d %d”, *d, *(d+1), *(d+2), *(d+3) ) ; printf ( ”%d %d”, *( c+1 ), *( c+2 ) ) ; } 503 504 501 0’s & 1’s 0’s & 1’s 0’s & 1’s 0’s & 1’s 501 501
  • 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