3.2. Gets() and puts() functions


The char *gets(char *s) function reads a line from stdin into the buffer pointed to by s until either a terminating newline (‘\n’)or EOF (End of File). *s means a pointer.

The int puts(const char *s) function writes the string ‘s’ and ‘a’ trailing newline to stdout.


#include <stdio.h>
int main( ) 
   char str[100];
   printf( "Enter a value :");
   printf( "\nYou entered: ");
   return 0;

NOTE! This chapter does not include exercises but this information will be tested in quizzes 3-4! It is very important that the student will make all examples shown in this chapter.