I'm trying to understand how to write a function to fill an array of strings using gets(array_name),i being the row index. Ihave no clue how to even start this I have created a driver that declares a 2-D array that is a list of strings with one string per row. I don't know how to write this function however to fill the array up with strings. If anyone can just get me started I would really appreciate it, this is sadly all I have.


#include "driver.h"
void fill_it(char strings[][LENGTH], int* count) {

Never use gets. It's impossible to make gets safe. All you need to do is match declarations:

char strings[N][LENGTH];

...

void f ( char strings[N][LENGTH], int size );

Then it's just a matter of counting from 0 to size - 1 and using fgets to fill strings with a line. For example:

int i;

for ( i = 0; i < size; i++ )
  fgets ( strings[i], LENGTH, stdin );