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

c/Prog3

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/Prog3
Read OK:
File size: 0125 bytes
Load address: 0000
Exec address: 0000
File contents
/* Program 3 */
#include <stdio.h>
#include <string.h>

main()
{                           /* Set up the variables used */
  int i;
  char string[20];

  strcpy(string,"noside samoht");
  for(i=0;i<13;i++)
    if(string[i] == 0) break;
    printf("%c",string[12-i]);
  printf("\nFinished.");
}
00000000  2f 2a 20 50 72 6f 67 72  61 6d 20 33 20 2a 2f 0a  |/* Program 3 */.|
00000010  23 69 6e 63 6c 75 64 65  20 3c 73 74 64 69 6f 2e  |#include <stdio.|
00000020  68 3e 0a 23 69 6e 63 6c  75 64 65 20 3c 73 74 72  |h>.#include <str|
00000030  69 6e 67 2e 68 3e 0a 0a  6d 61 69 6e 28 29 0a 7b  |ing.h>..main().{|
00000040  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000050  20 20 20 20 20 20 20 20  20 20 20 2f 2a 20 53 65  |           /* Se|
00000060  74 20 75 70 20 74 68 65  20 76 61 72 69 61 62 6c  |t up the variabl|
00000070  65 73 20 75 73 65 64 20  2a 2f 0a 20 20 69 6e 74  |es used */.  int|
00000080  20 69 3b 0a 20 20 63 68  61 72 20 73 74 72 69 6e  | i;.  char strin|
00000090  67 5b 32 30 5d 3b 0a 0a  20 20 73 74 72 63 70 79  |g[20];..  strcpy|
000000a0  28 73 74 72 69 6e 67 2c  22 6e 6f 73 69 64 65 20  |(string,"noside |
000000b0  73 61 6d 6f 68 74 22 29  3b 0a 20 20 66 6f 72 28  |samoht");.  for(|
000000c0  69 3d 30 3b 69 3c 31 33  3b 69 2b 2b 29 0a 20 20  |i=0;i<13;i++).  |
000000d0  20 20 69 66 28 73 74 72  69 6e 67 5b 69 5d 20 3d  |  if(string[i] =|
000000e0  3d 20 30 29 20 62 72 65  61 6b 3b 0a 20 20 20 20  |= 0) break;.    |
000000f0  70 72 69 6e 74 66 28 22  25 63 22 2c 73 74 72 69  |printf("%c",stri|
00000100  6e 67 5b 31 32 2d 69 5d  29 3b 0a 20 20 70 72 69  |ng[12-i]);.  pri|
00000110  6e 74 66 28 22 5c 6e 46  69 6e 69 73 68 65 64 2e  |ntf("\nFinished.|
00000120  22 29 3b 0a 7d                                    |");.}|
00000125