Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.1

# StrPtr::operator []( int )

Return the character at the specified index.

Virtual? | No |
Class | `StrPtr` |
Arguments | `int x` | the index to look in
Returns | `char` | the character at that index

## Notes

This operator does no bounds checking, and can therefore return data from beyond the end of the string.

## Example

Copy

    #include &lt;stdhdrs.h&gt;
    #include &lt;strbuf.h&gt;

    int main( int argc, char **argv )
    {
        StrBuf str1;

        str1.Set( "the quick brown fox jumps over the lazy dog" );

        printf( "%c%c%c%c%c\n", str1[1], str1[2], str1[35], str1[35], str1[12] );

        return 0;
    }

Executing the preceding code produces the following output:

    hello

Your search for returned results