Hello Friends, This is Suraj Giri from Technical Glamour . In this Blog I have discussed about
How to run C and C++ program in Android using Termux Terminal Emulator. I have installed Nano editor in Termux for writing source code and Clang Compiler for compile and run the program.
For visual understanding of How To Run C And C++ Program In Android Using Termux, Must watch this video. In this video each step is shown cleary with all common doubt solving
We know that to write programs we need an Editor. You must have listen about some well known editors to write codes. e.g VS Code, Nano, VI , Notepad++ etc. Generally Nano and VI editors are used in Unix based OS. So, In termux we can install anyone from both and by the way many more editors are also available for Unix OS to be used in termux. In this blog we will learn about Installation Process of Nano in Termux.
We must required a compiler to find bugs or error and to execute our codes. You must have listen about some well known compilers to execute the program. e.g Clang, gcc, tubo c++ etc. Generally gcc and clang compilers are used widely. In this blog we will learn about Installation Process of Clang in Termux.
So, let's discuss about the steps involves in Installing Clang Compiler and Nano Editor to run C and C++ Program in android. Follow the following steps to understand the process of installing nano editor and clang compiler in Android:
Step 1. Download the Termux Application from below link. Actually Termux is a terminal emulator which provides the environment of Linux in Android operating system. You can install lot's of hacking and testing tools using this and use as per your need. If you want to tutorial on Termux then comment below I will surely write an article on it. Download Termux from this link..
https://play.google.com/store/apps/details?id=com.termux
Step 2. Now open the termux and clear the screen using command "clrscr".Then write command "apt update && apt upgrade". It will update and upgrade, all the inbuilt tools of Termux.
Step 3. Now Install Nano using command "apt install nano"
Step 4. Now Install Clang usng command "apt install clang"
Now you have completed the important steps.
Following commands and points are useful in writing code, so learn it :
1) To create or modify any file ~ "nano file_name"
>You can also simply write "nano" to open nano editor.
>There are lot's of shortcut are given in nano home screen, so you can use it. Keep in mind this symbol '^' specify ctrl.
>Must write file extension during saving to get syntax color of that language. Like .c for C, .cpp for C++ etc.
>Save the file initially with appropriate extension, so you wil get the syntax color.
2) To Compile program of any file ~ "clang file_name" . You will get error on terminal if there error in code else write ".\a.out" to execute the program.
I hope you got all my points. So, Thanking You for your time. See you next time.......
Comments
Post a Comment