So, i'm having some problems with this project.
The objective is, read the word from the .txt (35042 words) and store them in the vector s, where each element of the vector is a word.
So, i'm having some problems with this project.
The objective is, read the word from the .txt (35042 words) and store them in the vector s, where each element of the vector is a word.
What sort of problems are you having? (we don't know, you didn't post code).
How far have you got?
- open and close the file
- read one word from the file and print it using printf
- read all the words from the file, and print them
What kind of vector are you thinking of using?
char words[35042][20];
Is very clunky, but it allows you to get the rest of the code working without the complication of pointers and malloc.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
When you say, "vector" I immediately think you might be asking a C++ question. This is the C programming forum - you're likely to get much more answers if you ask C++ questions in the right place.