0
C fgets??
How to use fgets in a loop properly, to store text in a 2D array?
9 Antworten
+ 10
arr[size][50];
for(int i = 0; i < size; i++)
fgets(arr[i], 50, stdin);
+ 9
Welcome :)
+ 9
Steam can you elaborate more with the output example?
+ 8
Steam Oh sorry, I forgot you need it in C and I sent you in C++
+ 7
Check this link for better explanation:
https://www.tutorialspoint.com/cplusplus/cpp_array_of_pointers.htm
+ 1
Thank you!
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?
0
nAutAxH AhmAd ,can you please explain how I can use an array of pointers, instead of 2d array?
0
Thank you, I already used malloc, it works)