All pastes #198979 Raw Edit

Miscellany

public text v1 · immutable
#198979 ·published 2006-10-12 08:47 UTC
rendered paste body
char    *my_strstr(char *str, char *to_find)
{
  int   adresse;
  int   compteur;
  int   lenght;
  int   var;
 
  var = 0;
  lenght = my_strlen(to_find);
  compteur = 0;
  while (str[compteur + var] != to_find[var])
    {
      compteur++;
      if (str[compteur + var] == to_find[var])
        {
          while (str[compteur + var] == to_find[var])
            {
              var++;
              if (str[compteur + var] == to_find[lenght - 1])
                {
                  return (&str[compteur]);
                }
            }
        }
    }
}