Text Analysis/assign3.c
int wordLengthAnalysis(char **bufferPtr, int numOfLines, int length){
    
    //makes a copy of the original data to avoid data destruction
    char copy[MAX_LINES * MAX_LINE_LENGTH];
    make1DArrayFrom2D(copy, bufferPtr, numOfLines);
    
    char *strTokenPtr;
    int count = 0;
    
    strTokenPtr = strtok(copy, " \r\n");
    while(strTokenPtr != NULL){
        if(strlen(strTokenPtr) == length){
            count++;
        }
        strTokenPtr = strtok(NULL, " \r\n");
    }
    
    return count;
}
/*
    wordLengthAnalysis: analyses the amount of words that are of a certain length
    input: an array of text (bufferPtr), the number of lines to be analysed (numOfLines), the length of a word to look for (length)
    output: the amount of words (count) found having the specified length 
*/
analyses the amount of words that are of a certain length
input: an array of text (bufferPtr), the number of lines to be analysed (numOfLines), the length of a word to look for (length)
output: the amount of words (count) found having the specified length
analyses the amount of words that are of a certain length input : an array of text ( bufferPtr ) the number of lines to be analysed ( numOfLines ) the length of a word to look for ( length ) output : the amount of words ( count ) found having the specified length
int wordLengthAnalysis(char **bufferPtr, int numOfLines, int length){
    char copy[MAX_LINES * MAX_LINE_LENGTH];
    make1DArrayFrom2D(copy, bufferPtr, numOfLines);
    char *strTokenPtr;
    int count = 0;
    strTokenPtr = strtok(copy, " \r\n");
    while(strTokenPtr != NULL){
        if(strlen(strTokenPtr) == length){
            count++;
        }
        strTokenPtr = strtok(NULL, " \r\n");
    }
    return count;
}
int wordLengthAnalysis ( char * * bufferPtr , int numOfLines , int length ) { char copy [ MAX_LINES * MAX_LINE_LENGTH ] ; make1DArrayFrom2D ( copy , bufferPtr , numOfLines ) ; char * strTokenPtr ; int count = 0 ; strTokenPtr = strtok ( copy , " \r \n " ) ; while ( strTokenPtr != NULL ) { if ( strlen ( strTokenPtr ) == length ) { count ++ ; } strTokenPtr = strtok ( NULL , " \r \n " ) ; } return count ; }
wordLengthAnalysis: analyses the amount of words that are of a certain length
input: an array of text (bufferPtr), the number of lines to be analysed (numOfLines), the length of a word to look for (length)
output: the amount of words (count) found having the specified length
wordLengthAnalysis : analyses the amount of words that are of a certain length input : an array of text ( bufferPtr ) the number of lines to be analysed ( numOfLines ) the length of a word to look for ( length ) output : the amount of words ( count ) found having the specified length
//makes a copy of the original data to avoid data destruction