#include <stdio.h>

int index(s, c)
    register char *s;
    register char c;
    {
        int idx = 0;
        int len = 0;

        while (*(s + len++) != '\0');

        while ( (*s++ != c) && (idx < len) )
           ++idx;

        return idx == len ? -1 : idx;

/*      while ((*s++ != c) && *s )
           idx++;
        return *s == 0 ? (c == '\0'? idx : -1) : idx;
*/
    }

