/ Sams Teach Yourself C in 21 Days (6th Edition)
/ STYC216E.ISO / mac / Examples / Day20 / calloc.c ![]() | next > |
MacBinary | 2002-08-11 | 1.0 KB | [TEXT/LMAN] |
Confidence | Program | Detection | Match Type | Support |
---|---|---|---|---|
66% | dexvert | Compact Compressed (Unix) (archive/compact) | ext | Supported |
10% | dexvert | MacBinary (archive/macBinary) | fallback | Supported |
1% | dexvert | Text File (text/txt) | fallback | Supported |
100% | file | MacBinary II, Sun Aug 11 11:24:48 2002, modified Sun Aug 11 11:24:48 2002, creator 'LMAN', type ASCII, 422 bytes "calloc.c" , at 0x226 286 bytes resource | default (weak) | |
99% | file | data | default | |
74% | TrID | Macintosh plain text (MacBinary) | default | |
25% | TrID | MacBinary 2 | default (weak) | |
100% | siegfried | fmt/1762 MacBinary (II) | default | |
100% | lsar | MacBinary | default |
id metadata | |
---|---|
key | value |
macFileType | [TEXT] |
macFileCreator | [LMAN] |
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 63 61 6c 6c 6f 63 | 2e 63 00 00 00 00 00 00 |..calloc|.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 01 a6 00 | 00 01 1e b9 7c 32 40 b9 |........|....|2@.|
|00000060| 7c 32 40 00 00 00 00 00 | 00 00 00 00 00 00 00 00 ||2@.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 a4 96 00 00 |........|........|
|00000080| 2f 2a 20 44 65 6d 6f 6e | 73 74 72 61 74 65 73 20 |/* Demon|strates |
|00000090| 63 61 6c 6c 6f 63 28 29 | 2e 20 2a 2f 0d 0a 0d 0a |calloc()|. */....|
|000000a0| 23 69 6e 63 6c 75 64 65 | 20 3c 73 74 64 6c 69 62 |#include| <stdlib|
|000000b0| 2e 68 3e 0d 0a 23 69 6e | 63 6c 75 64 65 20 3c 73 |.h>..#in|clude <s|
|000000c0| 74 64 69 6f 2e 68 3e 0d | 0a 0d 0a 69 6e 74 20 6d |tdio.h>.|...int m|
|000000d0| 61 69 6e 28 20 76 6f 69 | 64 20 29 0d 0a 7b 0d 0a |ain( voi|d )..{..|
|000000e0| 20 20 20 20 75 6e 73 69 | 67 6e 65 64 20 6c 6f 6e | unsi|gned lon|
|000000f0| 67 20 6e 75 6d 3b 0d 0a | 20 20 20 20 69 6e 74 20 |g num;..| int |
|00000100| 2a 70 74 72 3b 0d 0a 0d | 0a 20 20 20 20 70 72 69 |*ptr;...|. pri|
|00000110| 6e 74 66 28 22 45 6e 74 | 65 72 20 74 68 65 20 6e |ntf("Ent|er the n|
|00000120| 75 6d 62 65 72 20 6f 66 | 20 74 79 70 65 20 69 6e |umber of| type in|
|00000130| 74 20 74 6f 20 61 6c 6c | 6f 63 61 74 65 3a 20 22 |t to all|ocate: "|
|00000140| 29 3b 0d 0a 20 20 20 20 | 73 63 61 6e 66 28 22 25 |);.. |scanf("%|
|00000150| 6c 64 22 2c 20 26 6e 75 | 6d 29 3b 0d 0a 0d 0a 20 |ld", &nu|m);.... |
|00000160| 20 20 20 70 74 72 20 3d | 20 28 69 6e 74 2a 29 63 | ptr =| (int*)c|
|00000170| 61 6c 6c 6f 63 28 6e 75 | 6d 2c 20 73 69 7a 65 6f |alloc(nu|m, sizeo|
|00000180| 66 28 6c 6f 6e 67 20 6c | 6f 6e 67 29 29 3b 0d 0a |f(long l|ong));..|
|00000190| 0d 0a 20 20 20 20 69 66 | 20 28 70 74 72 20 21 3d |.. if| (ptr !=|
|000001a0| 20 4e 55 4c 4c 29 0d 0a | 20 20 20 20 20 20 20 20 | NULL)..| |
|000001b0| 70 75 74 73 28 22 4d 65 | 6d 6f 72 79 20 61 6c 6c |puts("Me|mory all|
|000001c0| 6f 63 61 74 69 6f 6e 20 | 77 61 73 20 73 75 63 63 |ocation |was succ|
|000001d0| 65 73 73 66 75 6c 2e 22 | 29 3b 0d 0a 20 20 20 20 |essful."|);.. |
|000001e0| 65 6c 73 65 0d 0a 20 20 | 20 20 20 20 20 20 70 75 |else.. | pu|
|000001f0| 74 73 28 22 4d 65 6d 6f | 72 79 20 61 6c 6c 6f 63 |ts("Memo|ry alloc|
|00000200| 61 74 69 6f 6e 20 66 61 | 69 6c 65 64 2e 22 29 3b |ation fa|iled.");|
|00000210| 0d 0a 20 20 20 20 72 65 | 74 75 72 6e 20 30 3b 0d |.. re|turn 0;.|
|00000220| 0a 7d 0d 0a 0d 0a 00 00 | 00 00 00 00 00 00 00 00 |.}......|........|
|00000230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000260| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000270| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000280| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000290| 54 68 69 73 20 72 65 73 | 6f 75 72 63 65 20 66 6f |This res|ource fo|
|000002a0| 72 6b 20 69 6e 74 65 6e | 74 69 6f 6e 61 6c 6c 79 |rk inten|tionally|
|000002b0| 20 6c 65 66 74 20 62 6c | 61 6e 6b 20 20 20 00 00 | left bl|ank ..|
|000002c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000380| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000390| 00 00 00 00 00 00 00 00 | 00 1c 00 1e ff ff 00 00 |........|........|
|000003a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+