C Programming language

adplus-dvertising
Compilation and Execution in C
Previous Home Next

Compilation and Execution

Once you have written the program you need to type it and instruct the machine to execute it. To type your C program you need another program called Editor. Once the program has been typed it needs to be converted to machine language (0s and 1s) before the machine can execute it. To carry out this conversion we need another program called Compiler. Compiler vendors provide an Integrated Development Environment (IDE) which consists of an Editor as well as the Compiler. If you are a beginner you would be better off using a simple compiler like Turbo C or Turbo C++.here are the steps that you need to follow to compile and execute

your first C program:

  1. Start the compiler at C> prompt. The compiler (TC.EXE is usually present in C:\TC\BIN directory).
  2. Select New from the File menu.
  3. Type the program.
  4. Save the program using F2 under a proper name (say Program1.c).
  5. Use Ctrl + F9 to compile and execute the program.
  6. Use Alt + F5 to view the output.

If you run this program in Turbo C++ compiler, you may get an error-- "The function printf should have a prototype". To get rid of this error, perform the following steps and then recompile the program.

  1. Select ‘Options’ menu and then select ‘Compiler | C++ Options’. In the dialog box that pops up, select ‘CPP always’ in the ‘Use C++ Compiler’ options.
  2. Again select ‘Options’ menu and then select ‘Environment | Editor’. Make sure that the default extension is ‘C’ rather than ‘CPP’.
Previous Home Next