Can you fgets multidimensional arrays with this loop structure? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you fgets multidimensional arrays with this loop structure?

Is this valid, or doI have to do two separate loops? for(i=0, j=0; i<width, j<height; i++, j++){ fgets(strings[i],strings[j],stdin); } Can you pass two different integers as array dimensions into a for loop?

18th Feb 2020, 8:46 AM
Veli-Matti
1 Answer
+ 2
The syntax for fgets char * fgets ( char * str, int num, FILE * stream ); Parameters: - First is the string buffer. - Second is buffer size - Third is source of data It will not accept 2 string buffers. Hope this clears your doubt. http://www.cplusplus.com/reference/cstdio/fgets/
18th Feb 2020, 10:24 AM
Ipang