If I know the sizes I'm using, I can declare the array as:

char arr[20][20];

Is this correct? Well, I want to know how to insert a full string into the array of strings. I thought it might be:

fscanf(infile, "%s", *arr[i]);

but this line gave me the error "warning: format argument is not a pointer (arg 3)".

Recommended Answers

All 2 Replies

Well, I want to know how to insert a full string into the array of strings. I thought it might be:

fscanf(infile, "%s", *arr[i]);

but this line gave me the error "warning: format argument is not a pointer (arg 3)".

No. It would be fscanf(infile, "%s", arr[i]); But, see this about scanf/fscanf. It would be better to use fgets() instead.

No. It would be fscanf(infile, "%s", arr[i]); But, see this about scanf/fscanf. It would be better to use fgets() instead.

So the compiler guesses that the means the outer part of the array and whenever reading in single characters, then I write in the other index?

I'm using fscanf to read single words between whitespace or newlines.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.