aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/tests/posix/rindex.c
blob: 0eb2f5476cab6876b123055ba73ec75ce8b72616 (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <strings.h>
#include <assert.h>

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