Thread: An assignment problem

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    21

    An assignment problem

    Hi I've this string tokenizer assignment problem. I want to do this by myself but juz need some advise to get started.

    Given a header file with these function protoypes:
    Code:
    typedef struct strTokenizerRec *stringTokenizer;
    
    stringTokenizer createStringTokenizer(char[], char);
    // pre: true,
    // post: return a stringTokenzier for char[] with char as delimiter
    
    int countTokens(stringTokenizer);
    
    int hasMoreTokens(stringTokenizer);
    
    char* nextToken(stringTokenizer*);
    
    void destroyStringTokenizer*);
    
    void displayLine(stringTokenzier strT);
    What is the use of createStringTokenizer()? My understandin is it required 2 arguments, 1 is an array and the other is a char and it return a stringTokenizer.

    My input would be something like XXX~XXX~XXX~ after readin from a file. Am I correct to say that the array is the XXX~XXX~XXX~? How abt the char? What would be the output of the stringTokenizer?

    Heap tks....
    Last edited by EeeK; 10-03-2003 at 05:46 PM.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Well it appears before you can call nextToken(), you must create a stringTokenizer struct. So you take the array and delimiter, and return a stringTokenizer struct. So the first question is: what is contained within a stringTokenizer struct?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  2. Another assignment problem
    By the_winky_files in forum C Programming
    Replies: 14
    Last Post: 10-03-2005, 10:33 AM
  3. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM
  4. problem on assignment
    By rodney1001 in forum C Programming
    Replies: 1
    Last Post: 10-29-2001, 03:49 PM
  5. homework assignment problem
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 10-29-2001, 10:24 AM