How can i read multiple line of string with spaice in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can i read multiple line of string with spaice in c++

I try to use gets() in for() loop but it give an error when passing a array as an argument.

21st Feb 2017, 4:32 PM
Muhammed Raziq
Muhammed Raziq - avatar
5 Answers
+ 2
i want to read multiple l string in a array
21st Feb 2017, 6:58 PM
Muhammed Raziq
Muhammed Raziq - avatar
+ 1
it read 10 number of charector string not multiple line
21st Feb 2017, 8:27 PM
Muhammed Raziq
Muhammed Raziq - avatar
0
char a[10]; gets(a); this will work
21st Feb 2017, 5:17 PM
Sandip
0
you don't need a for loop
21st Feb 2017, 5:17 PM
Sandip
0
increase the array size. i just have this as an example. you can initialize it as char a[100] for 100 characters including space.
22nd Feb 2017, 11:20 AM
Sandip