Share this page

# 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

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: