aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/tests/ansi/strrchr.c
blob: 2de98219a8fef8c11220f035e1f7552a032b92dc (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <string.h>
#include <assert.h>

int main() {
  char str[] = "This is a sample string";
  char *pch;
  pch = strrchr(str, 's');
  // The last occurence of 's' is at position 18
  assert(pch - str + 1 == 18);
  return 0;
}