void main()
{
   char pattern[]= "ciao";
   testo = "......";
   int i=0, j=0;
   while (testo[i] != '\0')
   {
      j=0;
      while (pattern[j] == testo[i+j] && pattern[j] != '\0')
      {
         j++;
         if (pattern[j] == '\0')
         {
            printf("trovato a posizione %d\n", i);
            return;
         }
      }
      i++;
   }
   printf("Non trovato !\n");
   return;
}

-- ElisabettaDAiutolo - 15 Nov 2002

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2003-10-04 - AndreaSterbini






 
Questo sito usa cookies, usandolo ne accettate la presenza. (CookiePolicy)
Torna al Dipartimento di Informatica
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback