Friday, December 11, 2009

3.5 THE gets AND puts FUNCTIONS

C contains a number of other library functions that permit some form of data transfer into or out of the computer.

The gets and puts functions offer simple alternatives to the use of scanf and printf for reading and displaying strings,as illustrated in the following example.

#include

main()     /*read and write a line or text*/

{

char line[80];
gets(line);
puts(line);

}

This program utilizes gets and puts,rather than scanf and printf,to transfer the line of text into and out of the computer.

No comments:

Post a Comment