Minggu, Januari 19, 2014

Introduction to getch() function on C programming

On C programming language, there is a function named getch() function, its sintax writing as follows:

getch();

this getch actually is abbreviation of getcharacter.

What are using of getch function?
  • Stop a ongoing process
  • Read input from keyboard. Character is gotten from keyboard only one character
Example:
  • Open C program
  • Create a new file, and save the file
  • Type main(){}
  • Menu Execute > Compile
  • After compile is done (success), Menu Execute > Run, then Run result will not be seen, only seen a black window for a moment and close again immediately
Now try to add getch(); in curly braces of main(), so that program sintax be:

main(){ getch(); }

Now try to do again:
  • Menu Execute > Compile
  • Menu Execute > Run
Hm, now has been seen its run result, it is a blank page. Now try to type one character, then run result window will close immediately. Approsimately function of getch()

Correction please... : )

source:
http://novanarie.blogspot.com

0 komentar: