![| Learn C++ How To Execute A C Program In Terminal](https://i0.wp.com/learncplusplus.org/wp-content/uploads/2023/04/pexels-andrea-piacquadio-3768894-scaled-e1680900804755.jpg?resize=1140%2C694&ssl=1)
![| Learn C++ How To Execute A C Program In Terminal](https://i0.wp.com/learncplusplus.org/wp-content/uploads/2023/04/pexels-andrea-piacquadio-3768894-scaled-e1680900804755.jpg?resize=1140%2C694&ssl=1)
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,
Table of Contents
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.
![| Learn C++ How To Execute A C Program In Terminal A hello World C program](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2022/06/HelloWorld-4006165.png?w=750&ssl=1)
![| Learn C++ How To Execute A C Program In Terminal A hello World C program](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2022/06/HelloWorld-4006165.png?w=750&ssl=1)
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,
1 |
#include <stdio.h> |
Second, you should add the main
procedure (the main program, the main function) as below,
1 2 3 4 |
int main() { } |
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.
1 2 3 4 5 6 7 8 9 |
#include <stdio.h> int main() { printf("Hello World"); getchar(); return 0; } |
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.
![| Learn C++ How To Execute A C Program In Terminal The Bcc results](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2022/06/BCC32C_760-3380590.jpg?w=750&ssl=1)
![| Learn C++ How To Execute A C Program In Terminal The Bcc results](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2022/06/BCC32C_760-3380590.jpg?w=750&ssl=1)
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,
1 2 3 4 5 |
bcc32c.exe myproject.c -o2 |
How to execute a C program in Terminal with A professional C++ compiler?
![C++ Builder Common Libraries Run Time Library Parallel Programming Library | Embarcadero RAD Studio Delphi C++Builder Blogs | Learn C++ How To Execute A C Program In Terminal The C++ Builder logo](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2022/06/CBUIDER_STUDIO_FINAL_ICONS_64-9744851-4964591-6127446-4112068-5843153.png?w=750&ssl=1)
![C++ Builder Common Libraries Run Time Library Parallel Programming Library | Embarcadero RAD Studio Delphi C++Builder Blogs | Learn C++ How To Execute A C Program In Terminal The C++ Builder logo](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2022/06/CBUIDER_STUDIO_FINAL_ICONS_64-9744851-4964591-6127446-4112068-5843153.png?w=750&ssl=1)
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.
![| Learn C++ How To Execute A C Program In Terminal The RAD Studio IDE](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2022/06/RADS11.1U1Light_Welcome-9155681-1024x623.jpg?resize=750%2C456&ssl=1)
![| Learn C++ How To Execute A C Program In Terminal The RAD Studio IDE](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2022/06/RADS11.1U1Light_Welcome-9155681-1024x623.jpg?resize=750%2C456&ssl=1)
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,
1 2 3 4 5 |
bcc32c.exe myproject.c -o2 |
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.