C - string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C - string

How can I create a string var in C (If donโ€™t use scanf())

11th Jan 2020, 9:04 AM
Ethan
Ethan - avatar
3 Answers
+ 3
And yeah, it is not as convenient as in the other languages you started - that's C for you. ๐Ÿ˜‰
11th Jan 2020, 10:48 AM
HonFu
HonFu - avatar
+ 2
Use fgets().. fgets(charArray, maxsize, input_console) ;
11th Jan 2020, 9:17 AM
Jayakrishna ๐Ÿ‡ฎ๐Ÿ‡ณ
+ 1
There is a way for that. Here's an example, string c; or string s = " ". You can also declare it in a for loop.
24th Aug 2020, 2:17 PM
Sridhar
Sridhar - avatar