C Compiler | Compiler C Program | How to Run C Program | how to run C program in Turbo C++ | Program Structure of C

Prince Patel
By -
0

The C Compiler:

The source code written in source file is the human readable source for your program. It needs to be "compiled" into machine language so that your CPU can actually execute the program as per the instructions given.


The compiler compiles the source codes into final executable programs. The most frequently used and free available compiler is the GNU C/C++ compiler, otherwise you can have compilers either from HP or Solaris if you have the respective operating systems.


The following section explains how to install GNU C/C++ compiler on various OS. m We keep mentioning C/C++ together because GNU gcc compiler works for both C and C++ programming languages.


C Compiler (Software):

  1. Eclipse 
  2. NetBeans 
  3. Code :: Blocks
  4. Dev C++ 
  5. Borland C++ 
  6. Turbo C 
        Eclipse:
             Among open source software one best is Eclipse witadvance functionality for C/C++ programmers. It has many new features like syntax highlighting and auto code completion.It is compatible with all windows operating systems ,Linux and Mac OS X.
       NetBeans:
            NetBeans is basically java IDE but it can also be used for C/C++ if you have knowledge to use it.With this you can create C/C++ application and libraries.It has exclusive new features like highlighting,automatic formatting braces matching etc.
       Code :: Blocks:
            Code::blocks is a free open source utility which fulfill the demands of its users.It has new feature which other IDE lacks is that you can extend this IDE with the help of plugins available.
       Dev C++:
            Dev C++ is free ware IDE.It support C language with many new features like syntax highlighting,auto code completion,project manager and print support.It is GCC support compiler.
       Borland C++:
            Borland C++ is a IDE for C and C++ programming languages.It support r MS-DOS and Microsoft Windows. It has better debugger than turbo c.It is more better than turbo c in its performance and features.
       Turbo C:
            Turbo C/C++ is the oldest and ancient IDE for C and C++ programming.It was developed by Borlanb in 2008.Now it has come with new C++ builder which is known as rapid application development (RAD).
            Turbo C++ for Windows 7,8,8.1 and 10. The .NET Framework is required for Windows 7, Vista and XP, but there is no pre-requirement for more recent Windows versions.

How to install Turbo C++:    

    Step 1: Download from Turbo C/C++ Setup.exe From Internet.
    Step 2: If any previous version of "Turbo C++" install in your computer, then first of all uninstall that.
    Step 3: Run "setup.exe" file.
    Step 4: Follow the setup instructions.

How to use Turbo C++ 3.2

    Step 1: Double click on "Turbo C++" shortcut link on the desktop.
    Step 2: If you want run turbo c++ on full screen simply click on button "Run Turbo C++".
    Step 3: "OR" If you not want full screen mode uncheck the "Full screen mode" check box and click on button "Start Turbo C++".

Program Structure:-

    A C program basically consists of the following parts:
    • Preprocessor Commands 
    • Functions 
    • Variables
    • Statements & Expressions
    • Comments 


Let us look at a simple code that would print the words "Hello World":


     #include<stdio.h>
     int main()
     {
                 /* my first program in C */
                 printf("Hello, World! \n");
                 return 0;
     }  


Let us take a look at the various parts of the above program:

  • The first line of the program #include is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation.
  • The next line int main() is the main function where the program execution begins.
  • The next line /*...*/ will be ignored by the compiler and it has been put to add additional comments in the program. So such lines are called comments in the program. 
  • The next line printf(...) is another function available in C which causes the message "Hello, World!" to be displayed on the screen.
  • The next line return 0; terminates the main() function and returns the value 0. 

Compile and Run a C Program:

    Step 1: Open Turbo C by click on shortcut of TC or by location C:\TC\BIN\TC.exe
    Step 2: File > New and then write your C program.
    Step 3: Save the program using F2 (OR file > Save), remember the extension should be “.c”. As for example we are demo.c.
    Step 4: Compile the program using Alt + F9 OR Compile > Compile.
    Step 5: Press Ctrl + F9 to Run (or select Run > Run in menu bar ) the C program.
    Step 6: Alt+F5 to view the output of the program at the output screen.

Post a Comment

0Comments

Post a Comment (0)