LIVE Course for free

Rated by 1 million+ students
Get app now
0 votes
in Information Technology by (54.3k points)
closed by

Match the columns.

C commands


1. getch();

a. This command terminates the C program (main function) and returns 0.

2. return 0;

b. This indicates the end of the main function

3. }

c. This is the main function from where execution of any C program begins.

4. int main()

d. This command waits for any character input from the keyboard.

1. 1 - c, 2 - d, 3 - a, 4 - b
2. 1 - d, 2 - b, 3 - a, 4 - c
3. 1 - d, 2 - a, 3 - b, 4 - c
4. 1 - c, 2 - b, 3 - a, 4 - d

1 Answer

0 votes
by (30.0k points)
selected by
Best answer
Correct Answer - Option 3 : 1 - d, 2 - a, 3 - b, 4 - c

The following C commands are used for the following: 


  • It reads also a single character from the keyboard. But it does not use any buffer, so the entered character is immediately returned without waiting for the enter key.
  • getch() is a nonstandard function and is present in conio.h header file which is mostly used by MS-DOS compilers like Turbo C. It is not part of the C standard library or ISO C.
  • Syntax: int getch();

return 0;

  • It is not necessary that every time you should use return 0 to return the program's execution status from the main() function. But returned value indicates the program's success or failure to the operating system and there is only one value that is 0 which can indicate success and other non-zero values can indicate failure of execution due to many reasons.

  • For example - if the program's execution fails due to lake of memory we can return -1, if it fails due to file opening we can return -2, if it fails due to any invalid input value we can return -3, and so on. If the program's execution is a success we should return 0.


This indicates the end of the main function. When we write the last line of the code in main, we need to close the main() function by terminating the program with }.

int main();

1. The main() function is like other functions. It also takes arguments and returns some value. One point we have to keep in mind that the program starts executing from this main() function. So the operating system calls this function. When some value is returned from the main(), it is returned to the operating system.

2. The int main() indicates that the main() can return integer type data.

Hence option (3) is the correct answer.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.