Run C program on Android Device – C Programming Tutorial

In this c programming tutorial we are going to see How To run C programs on your android phone you need “Terminal IDE” android app installed on your phone. Click here to install this app from play store.

Once you have installed Terminal IDE, open it and now will see six buttons there on screen, from those buttons choose Install System, and then scroll down check the checkbox Overwrite ALL and then click Install System. By doing this some basic C / binary system files get installed in your phone (in applications private memory)

Next Step is to install gcc on your phone; it will take up to 70MB memory on your phone, to install gcc, go to the main options in app then terminal screen will be opened, type install_gcc on terminal and hit enter from your android keyboard now gcc is installed on your mobile.

To test it type cd  ~/system/src/c_examples/chello/ on terminal and hit enter , this will switch the current working directory of terminal to ~/system/src/c_examples/chello/. This directory already contains one test program. To see the file name and then open that c program type ls and then type cat hello.c  , now you can see it is a simple c program to print some message on the screen.

To compile this simple c program type terminal-gcc hello.c  and then to run the program type ./a.out , now you can see the output of this program on your screen.

You can also create your own c program and run using this app, just remember to use cd command to switch your current working directory to point to place where your program is present. You can even create and run java programs, shell script using this android application. For more details click on Help button from main screen of app and then select Tutorials, you can get all details about how to use this application.

Terminal IDE android app is available under GPLv2, code is available at:

Thank You for reading 🙂

C program for finding Optimal Binary Search Tree


optimal binary search tree

Least Common Sequence program in C


lcs c program code output

C program for Matrix chain multiplication

 Output :

matrix chain multiplication c program output

Doubly linked list operations in C language.


Mono-alphabetic Cipher Implementation – C Tutorial

A mono-alphabetic cipher is a type of simple substitution cipher. In this cipher technique each letter of the plaintext is replaced by another letter in the cipher-text. An example of a mono-alphabetic cipher key follows:
Plain Text   >>>   a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
Cipher Text >>>  z  w  x  y  o  p  r  q  a  h  c  b  e  s  u  t  v  f  g  j  l  k  m  n  d  i
This key means that any ‘a’ in the plaintext will be replaced by a ‘z’ in the cipher-text, any ‘z’ in the plaintext will be replaced by a ‘i’ in the cipher-text, and so on.
The following program shows the simple implementation of mono-alphabetic cipher technique in c language for encrypting and decrypting file

Compilers vs. Interpreters

       There are two general methods by which a program can be executed. It can be compiled, or it can be interpreted. Although programs written in any computer language can be compiled or interpreted, some languages are designed more for one form of execution than the other. For example, Java was designed to be interpreted, and C was designed to be compiled. However, in the case of C, it is important to understand that it was specifically optimized as a compiled language. Although C interpreters have been written and are available in some environments, C was developed with compilation in mind. Therefore, you will almost certainly be using a C compiler and not a C interpreter when developing your C programs.

     Since the difference between a compiler and interpreter may not be clear to all readers, the following brief description will clarify matters. In its simplest form, an interpreter reads the source code of your program one line at a time, performing the specific instructions contained in that line. This is the way earlier versions of BASIC worked. In languages such as Java, a program’s source code is first converted into an intermediary form that is then interpreted. In either case, a run-time interpreter is still required to be present to execute the program.

     A compiler reads the entire program and converts it into object code, which is a translation of the program’s source code into a form that the computer can execute directly. Object code is also referred to as binary code or machine code. Once the program is compiled, a line of source code is no longer meaningful in the execution of your program.

      In general, an interpreted program runs slower than a compiled program. Remember, a compiler converts a program’s source code into object code that a computer can execute directly. Therefore, compilation is a one-time cost, while interpretation incurs an overhead each time a program is run.