Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Telix/SALT v3.15 & RS-232, Hayes - <b>strchr</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  STRCHR

  .  Summary

  strchr(str <s>, int <pos>, int <c);

  .  Description

  The strchr function is used to search for a character within a
  string. <s> is the string to search, and <pos> is the starting posi-
  tion of the search, and <c> is the character (ASCII value) to search
  for. If the character, its offset is returned, otherwise a value of
  -1 is returned. Note that the first character in a string has an
  offset of 0, not 1 as in some languages.

  .  Return Value

  An integer value as described above.

  .  Example

  // Count how many times a certain char occurs in a string

  int i, count = 0;
  str s[] = "abcabcabcabcabc";

  i = 0;
  do
   {
    i = strchr(s, i, 'a');
    if (i != -1)
     count = count + 1;
   }
  while (i != -1);

See Also: ASCII table

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson