From: Alexsandro M. <mei...@gm...> - 2009-03-05 11:36:11
|
Dear all, I have build a function to tokenize a sentence and to return the words in my main function. It seems ok, but it's not working the way I intend. The code is: main() { char str[50]; char *array[50]; printf("Token 0.1\nDeveloped by Alexsandro Meireles\nType"); printf(" the sentence: "); gets(str); tokenizar(str); printf("\n"); printf("Word #%d is %s\n",0, array[0]); //PROBLEM IS HERE!!!!! system("pause"); } I need to have access to the words returned by the function tokenizar, but what I get as result, for example for "a casa pegou fogo." is: Word #0 is 'a' Word #1 is 'casa' Word #2 is 'pegou' Word #3 is 'fogo' AND THEN A LOOP Word #0 is Word #0 is Word #0 is Word #0 is ... IN OTHER WORDS, I CAN'T HAVE ACCESS TO THE ARRAY OF WORDS CREATED INSIDE 'tokenizar'. What am I doing wrong? Thanks in advance! -- Prof. Dr. Alexsandro Meireles, linguist Federal University of Espírito Santo Departamento de Línguas e Letras Av. Fernando Ferrari, 514. Campus Universitário Goiabeiras. 29075-910 Vitória-ES. Brazil mei...@gm... +55-27-41021734 |