QUOTE(no2pencil @ 6 Feb, 2008 - 10:45 AM)

QUOTE(QuietRiot @ 6 Feb, 2008 - 10:36 AM)

These other functions are for later, getWordList will return a char** with a list of all words (might need some help with that one too hehe). Also, how would I know how to separate words in the array (i.e when getting the list of words, when would I know if there is a new word and how would I store that in a 2d array).
If someone could take a look at what I have so far, that would be great. Thanks.
BTW, this will be tested with a test program my prof has created.
Well, for one you don't have a main function. Every C/C++ program must have a main! Your main is always the 1st to be ran & it also returns the exit value to the operating system, letting it know if there was an error or if it finished clean.
2nd, you don't declare any of the functions that you have for "later use".
The main method is in the test program the prof has made, I don't have to write it. Here is the test program:
CODE
#include <stdio.h>
#include <math.h>
#include <string.h>
extern void makeWordList (char*);
extern char **getWordList ();
extern int getNumWords ();
extern void compareFiles (char*, char*);
void printWordList (char *fileName)
{
char **words;
int i, numWords;
makeWordList (fileName);
words = (char**) getWordList ();
numWords = getNumWords ();
printf ("Words in file %s\n", fileName);
for (i=0; i<numWords; i++) {
printf (" %s\n", words[i]);
}
}
int main (int argc, char **argv)
{
printWordList ("ex2test1.txt");
printWordList ("ex2test2.txt");
printWordList ("ex2test3.txt");
compareFiles ("ex2test2.txt", "ex2test3.txt");
}
Based on this, I don't know if what I have so far is correct.