Prova con strtok:
codice:char * compute( char *text ) { char *ptr = strtok( text, " \n\t,.;:!\"?" ); char *str = ptr; while( ptr != NULL ) { str = strlen(ptr) > strlen(str) ? ptr : str; ptr = strtok( NULL, " \n\t,.;:!\"?" ); } return str; }
Prova con strtok:
codice:char * compute( char *text ) { char *ptr = strtok( text, " \n\t,.;:!\"?" ); char *str = ptr; while( ptr != NULL ) { str = strlen(ptr) > strlen(str) ? ptr : str; ptr = strtok( NULL, " \n\t,.;:!\"?" ); } return str; }
Fracty - The Fractal Generator
If you cannot choose a concise name that expresses what the method does, it is possible that your method is attempting to perform too many diverse tasks.