Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
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?
1 Antwort
+ 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/