Join The Discussion

Comments (1)

  1. Sudhakar Prajapati
    Sudhakar Prajapati:
    10 years ago

    It is a predefined function in "conio.h" (console input output header file) will tell to the console wait for some time until a key is hit given after running of program.

    By using this function we can read a character directly from the keyboard. Generally getch() are placing at end of the program after printing the output on screen.
    Example :
    #include
    #include

    void main()
    {
    int a=10, b=20;
    int sum=0;
    clrscr();
    sum=a+b;
    printf("Sum: %d",s);
    getch(); // use getch() befor end of main()
    }

    Output:
    Sum: 30

Related User Ask Questions