this is what I have done till now: I want to read words from file in C++ and I am allowed to use only cstring library. this is my piece of code
#include <cstring>
#include <fstream>
#include <stdio.h>
using namespace std;
int main(){
    ifstream file;
    char word[1];
    file.open("p.txt");
    while (!file.eof()){
        file >> word;
        cout << word << endl;
    }
    system("pause");
    return 0;
}
It is working fine and reading one word at a time. But I don't understand how this is working fine. How can char array of any size be it char word[1] or char word[50] read only one word at a time ignoring spaces.
And further I want to store these words in dynamic array. How can I achieve this? Any guidance would be appreciated?
 
     
     
     
     
     
     
     
    