C fgets?? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
0

C fgets??

How to use fgets in a loop properly, to store text in a 2D array?

7th Nov 2018, 9:35 AM
Steam
Steam - avatar
9 Respostas
+ 10
arr[size][50]; for(int i = 0; i < size; i++) fgets(arr[i], 50, stdin);
7th Nov 2018, 9:38 AM
blACk sh4d0w
blACk sh4d0w - avatar
+ 9
Welcome :)
7th Nov 2018, 9:40 AM
blACk sh4d0w
blACk sh4d0w - avatar
+ 9
Steam can you elaborate more with the output example?
7th Nov 2018, 7:19 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 8
Steam Oh sorry, I forgot you need it in C and I sent you in C++
18th Nov 2018, 2:38 PM
blACk sh4d0w
blACk sh4d0w - avatar
18th Nov 2018, 2:27 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 1
Thank you!
7th Nov 2018, 9:39 AM
Steam
Steam - avatar
0
I have finally finished my code, but my array shouldn't contain empty lines or white spaces before the line, how can I solve this?
7th Nov 2018, 7:14 PM
Steam
Steam - avatar
0
nAutAxH AhmAd ,can you please explain how I can use an array of pointers, instead of 2d array?
18th Nov 2018, 1:54 PM
Steam
Steam - avatar
0
Thank you, I already used malloc, it works)
18th Nov 2018, 2:37 PM
Steam
Steam - avatar