CC++Learn C++

How To Execute A C Program In Terminal

How To Execute A C Program In Terminal

C is one of the most powerful programming languages. You can create simple programs written in C using free C build tools and compilers that are available for the different operating systems like Windows, iOS, and Android. It has many pre-defined variables, functions, and libraries. Using a fast and reliable C++ compiler for Windows is very important for beginners and professionals since it helps C++ developers in remembering which language features exist, how to use them, and even detect errors when we get it wrong.

You can run a C program using the C or C++ compilers and build tools included with C++ Builder. C++ Builder has a free C++ Builder Community Edition as well as commercial C++ Builder Professional / Architect / Enterprise Versions with more extensive capabilities suitable for those who wish to go further with development or who do not fall within the restrictions of the Community Edition license terms.

As a C++ compiler, I believe the best professional C++ IDE and code editor to implement C++ Programs for Windows, iOS and Android is the latest version of RAD Studio or C++ Builder,

How To code and wxecute a C program In Terminal?

If you are new to programming, here is a quick introduction on how to create a simple C Program. C Programs (C code) is a text file, which means you can use any editor to edit these kinds of programs such as Notepad, Notepad++ and so on but a proper C++ IDE has much more dedicated features to edit and run C Programs. Suitable IDEs include Dev-C++, RAD Studio, and C++ Builder.

Before we get started, you should download and install a free C and C++ compiler and IDE.

How To Execute A C Program In Terminal A hello World C program

When you start coding, first of all, you should include any libraries that you are going to use. Generally, for beginners stdio.h library is enough to do simple beginner apps. We can include this library as below,

Second, you should add the main procedure (the main program, the main function) as below,

After that you should write your programming code lines into this procedure, between { and } brackets. If you are a beginner “Hello World” examples are good to understand feature of that programming language. It is good to understand how to edit text, how to write in its format, how to compile and link, how to debug and execute, how to deploy or release. This full example below is a “Hello World” C example that can be run with C++ Builder.

In C and C++, after every command you use you should put ; to the end of your commands. In this example above we print a text with printf() function and then we wait to get a character input (key press) with getchar(); functions, then we exit and return 0; which means our main app successfully run and exit.

How to execute a C Program in Terminal with a free C++ Compiler?

There are different Embarcadero C++ Compilers for different purposes. These are bcc, bcc32c, bcc32x, bccaarm, bcc64 executable compilers. developed 2012-2022 Embarcadero Technologies, Inc. There is a free Win32 compiler officially listed as a free C++ Compiler in the Official Web Page of Embarcadero.

How To Execute A C Program In Terminal The Bcc results

This free download of the C++ Compiler includes C11 language support, the Dinkumware STL (Standard Template Library) framework, and the complete Embarcadero C/C++ Runtime Library (RTL). In this free version, you’ll also find a number of C/C++ command line tools—such as the high-performance linker and resource compiler.

The Free C++ Compiler download includes:

  • Embarcadero C++ Compiler (bcc32c/bcc32x)
  • Turbo Incremental Linker (tlink32)
  • C++ Win32 Preprocessor (cpp32)
  • Import Library utility—for creating import libraries from DLLs (implib)
  • Librarian for symbol case-conversion, creating extended libraries and modifying page size (tlib)
  • Other useful command-line utilities such as make, grep, and touch
  • Includes the Embarcadero C/C++ Runtime Library, and the DinkumwareANSI/ISO Standard Template Library (STL)

C++Builder includes compilers for Win32, Win64 and iOS. And, C++Builder also features a modern, high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform UI development. Learn more about RAD Studio on its product page.

How to execute a C program in terminal?

You can simply use one of these C++ compiler to compile C programs. For example, if your C program file is myproject.c you can compile this with optimization level 2 (-o2) as below,

How to execute a C program in Terminal with A professional C++ compiler?

How To Execute A C Program In Terminal The C++ Builder logo

In general, you can run C programs with the latest C++ Compilers and Editors today. C++ Builder Professional, Enterprise and Architect Editions are able to run C programs. There is a free C++ Builder Community Edition for students, beginners, and startups too. Simply you can download, install and run your C programs in console applications. Moreover, you can enhance your C programs with C++ features and modern GUIs, which means you can mix and use C and C++ together. For the best modern app, later if you wish, you can update your C program to a C++ program.

C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, macOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. C++ Builder comes with Rapid Application Development Studio, also known as RAD Studio, and C++ Builder is one of the most professional IDE’s that work under RAD Studio. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.

How To Execute A C Program In Terminal The RAD Studio IDE
The Latest RAD Studio C++ Builder Welcome Screen

You can simply use the RAD Studio Command Prompt to compile and execute C programs in terminal. For example, if your C program file is myproject.c you can compile this with optimization level 2 (-o2) as below,

You can download the free C++ Builder Community Edition here: https://www.embarcadero.com/products/cbuilder/starter.

Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. Please visit https://www.embarcadero.com/products/cbuilder.

Download RAD Studio 11 Now

See What’s New in RAD Studio 11

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
Artificial Intelligence TechC++C++11C++14C++17Language FeatureLearn C++

Learn How To Read The WAV Waveform Audio File Format In C++

C++C++11Learn C++

What Is Assignment Operator Overloading?

C++C++11Introduction to C++Learn C++Syntax

Full List Of Features In C++ 11

C++C++11C++14C++17C++20Introduction to C++Learn C++Syntax

How To Use Basic Methods Of Strings In C++?