Android is based on Linux Kernel so it's definitely possible to compile & run C/C++ programs on Android.
C is quite cross-platform , so a C Program written in Windows can Run on Linux ( and android ) and vice versa.
Special Note : You might be wondering why i included C++ where we should be only focusing on C.
The Reason is, C++ was actually developed as a superset of C Programming Language, and nowadays nobody builds a compiler specific for only C. So a compiler for C can also compile C++ programs
If You're New To C Programming or want to start learning C Programming , i recommend reading our article, Baby Steps in C Programming
So With Further Talking Let's Jump into to find ways to run C/C++ Programms in Android
Developed by IIEC, CXXDroid is fully fledged C/C++ IDE for Android. It has quite powerful features listed below
- Full Offline Compiler - No Internet Needed
- Package Manager available to get libraries
- Powerful Editor
- C/C++ interpreter (REPL)
- Code Examples
CXXDroid From Play Store
If you want to learn and experiment with C/C++ , I recommend using CXXDroid.
Install From : Play Store
Developed by Anton Smirnov, CppDroid is a quite famous and well known C/C++ IDE for Android , it's robust and reliable which has many features,
- Full Offline C/C++ compiler - No need of internet
- Smart Syntax Highlighting
- Auto Indentation
CppDroid from Play Store
If you want a full C/C++ Development workspace , I recommend using CppDroid.
But right Now there's one down point about it, It's not been updated in Play Store since 17 August,2017
Install it From : Play Store
Visit Their Official Website : https://www.cppdroid.info
Termux, the all-in-one solution which was also mentioned on our previous article , Python For Android - Run Python Programs in Android
As also mentioned in previous article, it's a terminal emulator for Android which means with help of it we can run any linux (almost any 😉) programs on Android.
To Install and Use C/C++ compiler in Termux (in Termux clang is the C/C++ compiler) ,
- Download & Install Termux from : Play Store
- After Installing execute this command
pkg install clang
- After Successfully installing
clangyou can compile C/C++ scripts.
After you'll get an executable
a.out which you can run using
If you're new to the world of programming and never used Command Line Applications I wouldn't recommend you to use Termux , use CXXDroid or CppDroid instead.
So Friends That's It For Now, See You Next Time. Have and Questions , Suggestions? Let me know the comments below 👇
If You Like My Work (My Articles, Stories, Softwares, Researches and many more) Consider Buying Me A Coffee ☕ 🤗