Share

Dev-C++

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

Tokenize Function

You are viewing a single message from this topic. View all messages.

  1. 2009-03-05 11:28:43 UTC
    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
    meirelesalex@gmail.com
    +55-27-41021734
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.