User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:stdio.h:getchar

Table of Contents

getchar

     #include <ctype.h>
     int getchar( void );
   Get a character

C Sourcecode Example

/* 
 * getchar example code
 * http://code-reference.com/c/stdio.h/getchar
 */
 
#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
#include <ctype.h>
 
int main ( void ) {
   int chars;
   printf("type in . to end your input : ");
 
   while ((chars = getchar()) != '.' ){
      putchar(chars);
   }
   return 0;
}

output

  output:
  user@host:~$ ./getchar 
  type in . to end your input : Test 1234.
  Test 1234
advertising
c/stdio.h/getchar.txt · Last modified: 2015/01/30 21:01 by 129.7.106.171

Impressum