Home » Archimedes archive » Acorn User » AU 1994-09.adf » !Extras_Extras » c/Prog6

c/Prog6

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1994-09.adf » !Extras_Extras
Filename: c/Prog6
Read OK:
File size: 0237 bytes
Load address: 0000
Exec address: 0000
File contents
/* Program 6 */
#include <string.h>
#include <stdio.h>

#define NAME1 6       /* Easily changed data        */
#define NAME2 3       /* at the strt of the program */

main()
{                               /* Set up the variables used */
  char names[10][20];

  strcpy(names[1],"William");   /* Set up all the names
  strcpy(names[2],"Patrick");
  strcpy(names[3],"Jon");
  strcpy(names[4],"Tom");
  strcpy(names[5],"Peter");
  strcpy(names[6],"Colin");
  strcpy(names[7],"Sylvester"); /* and then print two        */

  printf("%s %s",names[NAME1], names[NAME2]);
}
00000000  2f 2a 20 50 72 6f 67 72  61 6d 20 36 20 2a 2f 0a  |/* Program 6 */.|
00000010  23 69 6e 63 6c 75 64 65  20 3c 73 74 72 69 6e 67  |#include <string|
00000020  2e 68 3e 0a 23 69 6e 63  6c 75 64 65 20 3c 73 74  |.h>.#include <st|
00000030  64 69 6f 2e 68 3e 0a 0a  23 64 65 66 69 6e 65 20  |dio.h>..#define |
00000040  4e 41 4d 45 31 20 36 20  20 20 20 20 20 20 2f 2a  |NAME1 6       /*|
00000050  20 45 61 73 69 6c 79 20  63 68 61 6e 67 65 64 20  | Easily changed |
00000060  64 61 74 61 20 20 20 20  20 20 20 20 2a 2f 0a 23  |data        */.#|
00000070  64 65 66 69 6e 65 20 4e  41 4d 45 32 20 33 20 20  |define NAME2 3  |
00000080  20 20 20 20 20 2f 2a 20  61 74 20 74 68 65 20 73  |     /* at the s|
00000090  74 72 74 20 6f 66 20 74  68 65 20 70 72 6f 67 72  |trt of the progr|
000000a0  61 6d 20 2a 2f 0a 0a 6d  61 69 6e 28 29 0a 7b 20  |am */..main().{ |
000000b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000000c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 2f 2a  |              /*|
000000d0  20 53 65 74 20 75 70 20  74 68 65 20 76 61 72 69  | Set up the vari|
000000e0  61 62 6c 65 73 20 75 73  65 64 20 2a 2f 0a 20 20  |ables used */.  |
000000f0  63 68 61 72 20 6e 61 6d  65 73 5b 31 30 5d 5b 32  |char names[10][2|
00000100  30 5d 3b 0a 0a 20 20 73  74 72 63 70 79 28 6e 61  |0];..  strcpy(na|
00000110  6d 65 73 5b 31 5d 2c 22  57 69 6c 6c 69 61 6d 22  |mes[1],"William"|
00000120  29 3b 20 20 20 2f 2a 20  53 65 74 20 75 70 20 61  |);   /* Set up a|
00000130  6c 6c 20 74 68 65 20 6e  61 6d 65 73 0a 20 20 73  |ll the names.  s|
00000140  74 72 63 70 79 28 6e 61  6d 65 73 5b 32 5d 2c 22  |trcpy(names[2],"|
00000150  50 61 74 72 69 63 6b 22  29 3b 0a 20 20 73 74 72  |Patrick");.  str|
00000160  63 70 79 28 6e 61 6d 65  73 5b 33 5d 2c 22 4a 6f  |cpy(names[3],"Jo|
00000170  6e 22 29 3b 0a 20 20 73  74 72 63 70 79 28 6e 61  |n");.  strcpy(na|
00000180  6d 65 73 5b 34 5d 2c 22  54 6f 6d 22 29 3b 0a 20  |mes[4],"Tom");. |
00000190  20 73 74 72 63 70 79 28  6e 61 6d 65 73 5b 35 5d  | strcpy(names[5]|
000001a0  2c 22 50 65 74 65 72 22  29 3b 0a 20 20 73 74 72  |,"Peter");.  str|
000001b0  63 70 79 28 6e 61 6d 65  73 5b 36 5d 2c 22 43 6f  |cpy(names[6],"Co|
000001c0  6c 69 6e 22 29 3b 0a 20  20 73 74 72 63 70 79 28  |lin");.  strcpy(|
000001d0  6e 61 6d 65 73 5b 37 5d  2c 22 53 79 6c 76 65 73  |names[7],"Sylves|
000001e0  74 65 72 22 29 3b 20 2f  2a 20 61 6e 64 20 74 68  |ter"); /* and th|
000001f0  65 6e 20 70 72 69 6e 74  20 74 77 6f 20 20 20 20  |en print two    |
00000200  20 20 20 20 2a 2f 0a 0a  20 20 70 72 69 6e 74 66  |    */..  printf|
00000210  28 22 25 73 20 25 73 22  2c 6e 61 6d 65 73 5b 4e  |("%s %s",names[N|
00000220  41 4d 45 31 5d 2c 20 6e  61 6d 65 73 5b 4e 41 4d  |AME1], names[NAM|
00000230  45 32 5d 29 3b 0a 7d                              |E2]);.}|
00000237