home *** CD-ROM | disk | FTP | other *** search
/ Sams Teach Yourself C in 21 Days (6th Edition) / STYC216E.ISO / mac / Examples / Day11 / func.c < prev    next >
MacBinary  |  2002-05-03  |  1.5 KB  |  [TEXT/LMAN]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
10% dexvert Jesper Olsen Module (music/jesperOlsen) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Fri May 3 23:04:58 2002, modified Fri May 3 23:04:58 2002, creator 'LMAN', type ASCII, 929 bytes "func.c" , at 0x421 286 bytes resource default (weak)
99% file data default
49% TrID Macintosh plain text (MacBinary) default
33% TrID TTComp archive compressed (bin-4K) default (weak)
16% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[LMAN]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 06 66 75 6e 63 2e 63 | 00 00 00 00 00 00 00 00 |..func.c|........|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4c 4d 41 | 4e 00 00 ff ff ff ff 00 |.TEXTLMA|N.......|
|00000050| 00 00 00 00 00 03 a1 00 | 00 01 1e b8 f9 00 5a b8 |........|......Z.|
|00000060| f9 00 5a 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..Z.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 7a c5 00 00 |........|....z...|
|00000080| 2f 2a 20 44 65 6d 6f 6e | 73 74 72 61 74 65 73 20 |/* Demon|strates |
|00000090| 70 61 73 73 69 6e 67 20 | 61 20 73 74 72 75 63 74 |passing |a struct|
|000000a0| 75 72 65 20 74 6f 20 61 | 20 66 75 6e 63 74 69 6f |ure to a| functio|
|000000b0| 6e 2e 20 2a 2f 0d 0a 0d | 0a 23 69 6e 63 6c 75 64 |n. */...|.#includ|
|000000c0| 65 20 3c 73 74 64 69 6f | 2e 68 3e 0d 0a 0d 0a 2f |e <stdio|.h>..../|
|000000d0| 2a 20 44 65 63 6c 61 72 | 65 20 61 6e 64 20 64 65 |* Declar|e and de|
|000000e0| 66 69 6e 65 20 61 20 73 | 74 72 75 63 74 75 72 65 |fine a s|tructure|
|000000f0| 20 74 6f 20 68 6f 6c 64 | 20 74 68 65 20 64 61 74 | to hold| the dat|
|00000100| 61 2e 20 2a 2f 0d 0a 0d | 0a 73 74 72 75 63 74 20 |a. */...|.struct |
|00000110| 64 61 74 61 20 7b 0d 0a | 20 20 20 20 66 6c 6f 61 |data {..| floa|
|00000120| 74 20 61 6d 6f 75 6e 74 | 3b 0d 0a 20 20 20 20 63 |t amount|;.. c|
|00000130| 68 61 72 20 66 6e 61 6d | 65 5b 33 30 5d 3b 0d 0a |har fnam|e[30];..|
|00000140| 20 20 20 20 63 68 61 72 | 20 6c 6e 61 6d 65 5b 33 | char| lname[3|
|00000150| 30 5d 3b 0d 0a 7d 20 72 | 65 63 3b 0d 0a 0d 0a 2f |0];..} r|ec;..../|
|00000160| 2a 20 54 68 65 20 66 75 | 6e 63 74 69 6f 6e 20 70 |* The fu|nction p|
|00000170| 72 6f 74 6f 74 79 70 65 | 2e 20 54 68 65 20 66 75 |rototype|. The fu|
|00000180| 6e 63 74 69 6f 6e 20 68 | 61 73 20 6e 6f 20 72 65 |nction h|as no re|
|00000190| 74 75 72 6e 20 76 61 6c | 75 65 2c 20 2a 2f 0d 0a |turn val|ue, */..|
|000001a0| 2f 2a 20 61 6e 64 20 69 | 74 20 74 61 6b 65 73 20 |/* and i|t takes |
|000001b0| 61 20 73 74 72 75 63 74 | 75 72 65 20 6f 66 20 74 |a struct|ure of t|
|000001c0| 79 70 65 20 64 61 74 61 | 20 61 73 20 69 74 73 20 |ype data| as its |
|000001d0| 6f 6e 65 20 61 72 67 75 | 6d 65 6e 74 2e 20 2a 2f |one argu|ment. */|
|000001e0| 0d 0a 0d 0a 76 6f 69 64 | 20 70 72 69 6e 74 5f 72 |....void| print_r|
|000001f0| 65 63 28 73 74 72 75 63 | 74 20 64 61 74 61 20 64 |ec(struc|t data d|
|00000200| 69 73 70 6c 61 79 52 65 | 63 29 3b 0d 0a 0d 0a 69 |isplayRe|c);....i|
|00000210| 6e 74 20 6d 61 69 6e 28 | 20 76 6f 69 64 20 29 0d |nt main(| void ).|
|00000220| 0a 7b 0d 0a 20 20 20 20 | 2f 2a 20 49 6e 70 75 74 |.{.. |/* Input|
|00000230| 20 74 68 65 20 64 61 74 | 61 20 66 72 6f 6d 20 74 | the dat|a from t|
|00000240| 68 65 20 6b 65 79 62 6f | 61 72 64 2e 20 2a 2f 0d |he keybo|ard. */.|
|00000250| 0a 0d 0a 20 20 20 20 70 | 72 69 6e 74 66 28 22 45 |... p|rintf("E|
|00000260| 6e 74 65 72 20 74 68 65 | 20 64 6f 6e 6f 72 27 73 |nter the| donor's|
|00000270| 20 66 69 72 73 74 20 61 | 6e 64 20 6c 61 73 74 20 | first a|nd last |
|00000280| 6e 61 6d 65 73 2c 5c 6e | 22 29 3b 0d 0a 20 20 20 |names,\n|");.. |
|00000290| 20 70 72 69 6e 74 66 28 | 22 73 65 70 61 72 61 74 | printf(|"separat|
|000002a0| 65 64 20 62 79 20 61 20 | 73 70 61 63 65 3a 20 22 |ed by a |space: "|
|000002b0| 29 3b 0d 0a 20 20 20 20 | 73 63 61 6e 66 28 22 25 |);.. |scanf("%|
|000002c0| 73 20 25 73 22 2c 20 72 | 65 63 2e 66 6e 61 6d 65 |s %s", r|ec.fname|
|000002d0| 2c 20 72 65 63 2e 6c 6e | 61 6d 65 29 3b 0d 0a 0d |, rec.ln|ame);...|
|000002e0| 0a 20 20 20 20 70 72 69 | 6e 74 66 28 22 5c 6e 45 |. pri|ntf("\nE|
|000002f0| 6e 74 65 72 20 74 68 65 | 20 64 6f 6e 61 74 69 6f |nter the| donatio|
|00000300| 6e 20 61 6d 6f 75 6e 74 | 3a 20 22 29 3b 0d 0a 20 |n amount|: ");.. |
|00000310| 20 20 20 73 63 61 6e 66 | 28 22 25 66 22 2c 20 26 | scanf|("%f", &|
|00000320| 72 65 63 2e 61 6d 6f 75 | 6e 74 29 3b 0d 0a 0d 0a |rec.amou|nt);....|
|00000330| 20 20 20 20 2f 2a 20 43 | 61 6c 6c 20 74 68 65 20 | /* C|all the |
|00000340| 64 69 73 70 6c 61 79 20 | 66 75 6e 63 74 69 6f 6e |display |function|
|00000350| 2e 20 2a 2f 0d 0a 20 20 | 20 20 70 72 69 6e 74 5f |. */.. | print_|
|00000360| 72 65 63 28 20 72 65 63 | 20 29 3b 0d 0a 0d 0a 20 |rec( rec| );.... |
|00000370| 20 20 20 72 65 74 75 72 | 6e 20 30 3b 0d 0a 7d 0d | retur|n 0;..}.|
|00000380| 0a 76 6f 69 64 20 70 72 | 69 6e 74 5f 72 65 63 28 |.void pr|int_rec(|
|00000390| 73 74 72 75 63 74 20 64 | 61 74 61 20 64 69 73 70 |struct d|ata disp|
|000003a0| 6c 61 79 52 65 63 29 0d | 0a 7b 0d 0a 20 20 20 20 |layRec).|.{.. |
|000003b0| 70 72 69 6e 74 66 28 22 | 5c 6e 44 6f 6e 6f 72 20 |printf("|\nDonor |
|000003c0| 25 73 20 25 73 20 67 61 | 76 65 20 24 25 2e 32 66 |%s %s ga|ve $%.2f|
|000003d0| 2e 5c 6e 22 2c 20 64 69 | 73 70 6c 61 79 52 65 63 |.\n", di|splayRec|
|000003e0| 2e 66 6e 61 6d 65 2c 0d | 0a 20 20 20 20 20 20 20 |.fname,.|. |
|000003f0| 20 20 20 20 20 64 69 73 | 70 6c 61 79 52 65 63 2e | dis|playRec.|
|00000400| 6c 6e 61 6d 65 2c 20 64 | 69 73 70 6c 61 79 52 65 |lname, d|isplayRe|
|00000410| 63 2e 61 6d 6f 75 6e 74 | 29 3b 0d 0a 7d 0d 0a 0d |c.amount|);..}...|
|00000420| 0a 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000430| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000440| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000450| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000460| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000470| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000480| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000490| 54 68 69 73 20 72 65 73 | 6f 75 72 63 65 20 66 6f |This res|ource fo|
|000004a0| 72 6b 20 69 6e 74 65 6e | 74 69 6f 6e 61 6c 6c 79 |rk inten|tionally|
|000004b0| 20 6c 65 66 74 20 62 6c | 61 6e 6b 20 20 20 00 00 | left bl|ank ..|
|000004c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000500| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000580| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000590| 00 00 00 00 00 00 00 00 | 00 1c 00 1e ff ff 00 00 |........|........|
|000005a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+