I'm working on a project using C and for the project I must read in a text file and store each word into an array. I also have to remove the punctuation off the words, so I need to use a 2-Dimensional array in order to edit the words. I am having trouble figuring out how to get the words in the 2-D array it self. This is what I have done so far:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 1001
#define LINES 81
int main(void) {
    int stringSize;
    int i =0;
    char *x[MAX][LINES];
    char str[MAX];
    char y[MAX];
    FILE *fp;
    fp = fopen("TwoCitiesStory.txt","r");
    if(fp == NULL) {
        printf("Cannot open file.\n");
        exit(1);
    }
    while(!feof(fp)) {
        for(i=0;i<MAX;i++){
            fscanf(fp,"%s",x[i][LINES]);
        }
    }
    return 0;
}
 
     
     
     
    