New course! Every coder should learn Generative AI!
Try a free lesson0
D Sai Vishal
Tag the language in which you need...
In c, a string is sequence of continuous characters ended by \0.
So to take input and store use charecter array like:
char arr[20];
And in scanf use %s
scanf("%s", arr);
Now a word entered will be stored in arr array..
See by printf("%s", arr);
To accept a line of string or a sentence
Use fgets method like
fgets(arr, 20,stdin);
arr is char array
20 maximum length input taken
stdin is standard input taken from.
gets(arr) also works but not recommended always...