Example: memchr

The following example searches for the character `x' in the string "Example string".

    #include <string.h>
    char * p;
    char str[] = "Example string";
    p = (char *)memchr(str, 'x', strlen(str));
    if (p)
        lr_output_message ("Character x is at position %d\n", p - str + 1);
    else
        lr_output_message ("Character x was not found");
Example: Output:

Character x is at position 2