Computer Science, asked by prem3972, 1 year ago

answer guys...!!! what is the difference between gets( ) and puts( ) in c++ and where it is used and what is it's function?

Answers

Answered by meetika18
0

these are the functions involved in the operations of strings.

gets....

1.The gets() function enables the user to enter some characters followed by the enter key.

2. All the characters entered by the user get stored in a character array. The null character is added to the array to make it a string.

3.The gets() allows the user to enter the space-separated strings. and returns the string entered by the user.

Puts....

1.The puts() function is very much similar to printf() function. The puts() function is used to print the string on the console which is previously read by using gets() or scanf() function.

2. The puts() function returns an integer value representing the number of characters being printed on the console. 3.it prints an additional newline character with the string, which moves the cursor to the new line on the console, the integer value returned by puts() will always be equal to the number of characters present in the string plus 1.

for ex-

gets(name)

store the value in array which is provided by user like name of user

and puts(name)

will display the value on console window

Similar questions