How to Run C/C++ Programs on Android: 4 Ways

You may not have access to your laptop or computer every time when you want to code something, but your smartphone is always with you all the time. Although it is more easy and comfortable to code on a desktop screen, but imagine how it would be if you can code on your Android phone also?

Run C/C++ programs on Android

Luckily, this thing is possible. You can actually run C, C++, or any other programming language codes on Android. If you are a professional coder or even if you have just started learning C/C++ language, it will be helpful for you to run your codes on-the-go, from anywhere.

There are a number of third-party apps available on Google Play Store for free that can help you to compile and run C/C++ programs on your Android phone. Some of these apps need access to the internet, while some others can also work offline. Here we have reviewed the best ones.

1. Use Cxxdroid app to run C/C++ program


Cxxdroid is the most popular C/C++ IDE for Android. It has a simple and clean user interface which gives a very comfortable experience while coding. Here are some of the silent features of this app -
  • Cxxdroid app works offline. You can code, compile and run C/C++ programs on your Android phone even without any internet connection.
  • It supports input at the run-time i.e. if the program requires you to enter any input, you will be asked for it at the time when the program runs.
  • You can load C/C++ files from your phone. Other than that, you can also save your programs as a file (.cxx).
  • The app can identify all kinds of errors. If any errors are found in the code, they will be reported to you. It will also show you where the error actually occurred and how you can fix it.
  • There are free sample programs available in the app that you can use for your practice.
  • You can install additional libraries for C/C++ such as Boost, SQLite, ncurses, OpenSSL, and more.
  • There is a special feature in the app which allows you to share your code on Pastebin directly. This feature is quite useful when you want to share your program with someone else.
Now let's discuss how you can run your C/C++ programs. First, download and install Cxxdroid app on your Android phone. It's available on Google Play Store for free. After installing the app, open it.

Use Cxxdroid app to run C/C++ program

Now you can start writing your code in the code editor. There are shortcut keys available at the bottom of the screen. Once you are ready to run your program, tap the play button at the bottom-right corner. Boom... There you go!

If you want to save your program, tap the folder-like icon at the top of the screen and then click the Save option. After that, you will be asked to select the directory where you want to save it.

2. Use CppDroid app to run C/C++ programs


CppDroid is our next favorite app in the list of best C/C++ compiler apps for Android. Like Cxxdroid, this app can also compile and run your programs offline. There is a Navigator feature in the app that will create shortcut links to the code.

Now let's suppose you have a very large program. These shortcut links will help you to organize your code and jump to the specific section directly. For example, if you will click void main (), the app will take you to the place where this function is located in the code editor.

The only thing we dislike about the CppDroid is that it takes a lot of space on your phone. When you open the app for the first time, it will download libraries, tutorials, and examples from the internet. If you are new to C/C++ language, we will definitely recommend you to check out those tutorials and examples in the app.

To run your program on CppDroid, first you have to save and compile it. This can be done by clicking the floppy disk and lightning bolt icon at the top of the screen. After that, you can run the program by clicking the play button. If any errors are found during compilation, they will be displayed in the Diagnostics, Analysis, and Output tab at the bottom.

Run C/C++ codes on Android using CppDroid app

3. Use Dcoder app


If you are looking for an all-in-one compiler app for Android, then we will recommend you to use Dcoder. It supports over 33+ programming languages including C, C++, Java, Python, JS, HTML, and others. Unlike other apps that we have mentioned above, Dcoder app will only work online i.e. it needs an internet connection to compile and run your programs on its servers.

Dcoder - compiler and IDE app for Android

4. Use an online compiler tool


There are a number of online compiler tools available for C and C++ languages. Most of them aren't compatible with Android because of small screen size and some even don't allow you to select and paste text in the code editor. After researching for a while, we found this tool named Ideone.

Ideone is an all-in-one online compiler and IDE tool. It has a responsive user interface - that's why it works very well on Android phones also. This tool supports more than 60 programming languages. When you visit Ideone website, the default language is set to Java.

Use Ideone online compiler tool

You can change it to C or C++, whichever you want to use. Then you can write the source code with optional input data, and you are ready to go!

So this is our list of best compiler apps and tools that you can use to compile and run C/C++ programs on your Android phone. Let us know which one you find most productive. If you want to ask something related to this tutorial, feel free to share it in the comment section.
LihatTutupKomentar