<verbatim> 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; } </verbatim> -- Users.ElisabettaDAiutolo - 15 Nov 2002
This topic: Programmazione1/AA0506/PZ
>
WebHome
>
AppuntiEsercitazioni2002
>
RicercaDiUnaStringaNelTesto
Topic revision: r4 - 2003-10-04 - AndreaSterbini
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback