I have to allocate an array of 1000 pointers to character strings, read in each character string from stdin and strdup each line into the array. I did the following:

```
char *array[1000];
 int index = 0;
 for (int i = 0; i < 1000; i++) {
      scanf("%s", &array[i]);
      strdup(array[i]);
 }

```

I'm not sure if this is the correct way of going about it??

EDIT:

So, I need to plug the newline at the end of each line with a null character and I need to do it using the strlen function. I have the following:

```
  // Plug the newline where the end of 
  // a line is equal to '0/'
  index = strlen(array) - 1;    // line 30
  if (array[index] = '\n') {    // line 31
     array[index] = '\0';
  }

```

But Im getting the following error:

```
linesort.c: In function ‘main’:
linesort.c:30: warning: passing argument 1 of ‘strlen’ from incompatible pointer type
/usr/include/string.h:399: note: expected ‘const char *’ but argument is of type ‘char **’
linesort.c:31: warning: assignment makes pointer from integer without a cast
linesort.c:31: warning: suggest parentheses around assignment used as truth value

```

Please advise!