[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  SUBCHR

  .  Summary

  subchr(str <s>, int <pos>);

  .  Description

  The subchr function returns the character found at position <pos> in
  string <s>. Note that an integer (representing the ASCII value of
  the character) is returned, not a string. <pos> may be anywhere
  within the string length as defined. Note that positions start from
  0. The 1st character in a string is at position 0, the 40th at posi-
  tion 39, etc. A string defined with a length of 10 would have valid
  positions of 0 to 9, with position 10 always returning the 0 value
  that terminates all strings.

  .  Return Value

  An integer value as described above.

  .  Example

  // This will print out the contents of a test string, extracting
  // each character individually, and stopping when a 0 is reached
  // which marks the end of all proper strings

  int i;
  str s[] = "This is a test string";
  for (i = 0; subchr(s, i) != 0; ++i)
   printc(subchr(s, i));

See Also: setchr subchrs
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson