wcsrchr - C wchar.h

C examples for wchar.h:wcsrchr

Type

function

From


<cwchar>
<wchar.h>

Description

Locate last occurrence of character in wide string

Prototype

const wchar_t* wcsrchr (const wchar_t* ws, wchar_t wc);
      wchar_t* wcsrchr (      wchar_t* ws, wchar_t wc);

Parameters

Parameter Description
ws C wide string.
wc Wide character to be located.

Return Value

A pointer to the last occurrence of wc in ws.

If wc is not found, the function returns a null pointer.

Demo Code


#include <wchar.h>

int main ()/*from w ww . ja  v  a2  s .  c o  m*/
{
  wchar_t wcs[] = L"This is a sample wide string";

  wchar_t * pwc;

  pwc = wcsrchr (wcs,L's');

  wprintf (L"Last occurrence of L's' found at %d \n",pwc-wcs+1);

  return 0;
}

Related Tutorials