Co-Authored By:
Also know, what is the use of puts and gets in C?
C puts() function The puts() function is used to print the stringon the console which is previously read by using gets() orscanf() function. The puts() function returns an integervalue representing the number of characters being printed on theconsole.
- #define MAX 500.
- int main(){
- char arr[MAX];
- printf("Enter any sentence which can include spaces. ");printf("To exit press enter key. ");
- scanf("%[^ ]s",arr);
- printf("%s",arr);
- return 0; }
Additionally, what does puts mean in C?
puts() function in C puts() function is a file handling function inC programming language which is used to write a line to theoutput screen.
The similarity is that both are used to display contenton the screen. The difference is puts is used todisplay only strings. However, printf is used to displayinteger, float, character, hexa decimal values as well as strings.Display using puts: puts(string1);