.I 0 3 +++Date last modified: 02-Jun-1996 PTRTUT03.TXT 6/1/96 .D 1 1 .I 4 1 Version 0.3 .D 5 1 .I 85 1 goal is via feedback from those who find this material useful. .D 86 1 .I 93 3 P.O. Box 324 1-415-365-8452 Redwood City, CA 94064 Dec. 1995 .D 94 3 .I 180 8 However, the above definition of "lvalue" is somewhat modified for C to be.. An _object_ is a region of storage; an _lvalue_ is an expression referring to an object. As we become more familiar with pointers we will go into more detail on this. .D 181 9 .I 258 1 What the '&' operator does is retrieve the address .D 259 1 .I 286 6 ------------ Program 1.1 --------------------------------- /* Program 1.1 from PTRTUT02.TXT 12/14/95 */ #include .D 287 3 .I 406 4 ----------- Program 2.1 ----------------------------------- /* Program 2.1 from PTRTUT02.TXT 12/14/95 */ .D 407 1 .I 465 3 Earlier when discussing the term "lvalue" I stated that "An _object_ is a region of storage; an _lvalue_ is an .D 466 4 .I 587 3 /* Program 3.1 from PTRTUT02.TXT 12/14/95 */ .I 680 1 char *p = destination; .D 681 1 .I 686 1 return destination; .D 687 1 .I 724 1 incrementing the pointer value. This has to .D 725 1 .I 909 5 /* Program 5.1 from PTRTUT02.TXT 12/14/95 */ #include #include .D 910 3 .I 919 1 struct tag my_struct; /* declare the structure my_struct */ .D 920 1 .I 999 2 ------------ program 5.2 --------------------- /* Program 5.2 from PTRTUT02.TXT 12/14/95 */ .D 1000 1 .I 1202 2 /* Program 6.1 from PTRTUT02.TXT 12/14/95 */ .I 1425 1 arr2d, assigning the address of the two dimensional array arr2d to .D 1426 1 .I 1488 1 for(k = 0; k < 10; k++) .D 1489 1 .I 1542 6 --------------- Program 9.1 -------------------------------- /* Program 9.1 from PTRTUT02.TXT 12/14/95 */ #include #include .D 1543 2 .I 1553 1 rptr = malloc(nrows * COLS * sizeof(int)); .D 1554 1 .I 1559 3 return 0; } ------------- End of Prog. 9.1 -------------------------------- .D 1560 2 .I 1608 4 -------------- Program 9.2 ------------------------------------ /* Program 9.2 from PTRTUT02.TXT 12/14/95 */ #include .D 1609 2 .I 1616 1 int row; .D 1617 1 .I 1640 1 --------------- End 9.2 ------------------------------------ .D 1641 2 .I 1679 4 ----------------- Program 9.3 ----------------------------------- /* Program 9.3 from PTRTUT02.TXT 12/14/95 */ #include .D 1680 2 .I 1694 1 aptr = malloc(nrows * ncols * sizeof(int)); .D 1695 1 .I 1747 1 ------------- End Program 9.3 ----------------- .D 1748 1 .I 1774 4 ------------------- Program 9.4 ------------------------------------- /* Program 9.4 from PTRTUT02.TXT 12/14/95 */ #include .D 1775 2 .I 1788 1 int y, z; .D 1789 1 .I 1838 1 ------------------- End of Prog. 9.4 ---------------------------- .D 1839 1 .I 1901 1 /* Program bubble_1.c from PTRTUT02.TXT 12/14/95 */ .I 1962 1 to the actual algorithm. This results in bubble_2.c: .D 1963 1 .I 1965 2 /* Program bubble_2.c from PTRTUT02.TXT 12/14/95 */ .I 2018 6 /* Program bubble_3.c from PTRTUT02.TXT 12/14/95 */ #include int arr[10] = { 3,6,1,2,3,8,4,1,7,2}; .D 2019 4 .I 2072 6 /* Program bubble_4.c from PTRTUT02.TXT 12/14/95 */ #include int arr[10] = { 3,6,1,2,3,8,4,1,7,2}; .D 2073 4 .I 2133 1 Currently, in bubble_4.c, knowledge within bubble() as to the .D 2134 1 .I 2148 5 /* Program bubble_5.c from PTRTUT02.TXT 12/14/95 */ #include #include .D 2149 3 .I 2229 5 /* Program bubble_6.c from PTRTUT02.TXT 12/14/95 */ #include #include .D 2230 3 .I 2327 5 /* Program bubble_7.c from PTRTUT02.TXT 12/14/95 */ #include #include .D 2328 3 .I 2422 13 Bob Stout's collection of C code SNIPPETS. The content in this version is the same as that in PTRTUTOT.ZIP included in SNIP9510.ZIP with some minor typo corrections. I am always ready to accept constructive criticism on this material, or review requests for the addition of other relevant material. Therefore, if you have questions, comments, criticisms, etc. concerning that which has been presented, I would greatly appreciate your contacting me using one of the mail addresses cited in the Introduction. .D 2423 8