How to install C/C++ in Android using Termux

What is C ?

C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations.


How to install C ?

Open Termux app and type following commands

$ pkg install clang
$ pkg install nano

To write your c program type

$ nano filename.c

Hello world program in c :

#include <stdio.h>
int main()
{
   printf("Hello, World!");
   return 0;
}

To compile your c program type

$ gcc filename.c -o aliasname

Example : gcc hello.c -o h

To run your c program type

$ ./aliasname

Example : ./h


What is C++??

C++ is the general programming language almost everybody learns in their early programming days to build up a strong understanding of basic programming concepts. It is still a popular programming language in the programming language family. Many languages like JAVA and C# have been influenced by Cplusplus.

How to install C++ ?

Open Termux app and type following commands

$ pkg install clang

OR

$ pkg install g++

$ pkg install nano

To write your c++ program type

$ nano filename.cpp

Hello world program in c++

#include <iostream>
using namespace std;

int main() 
{
    cout << "Hello, World!";
    return 0;
}

To compile your c++ program type

$ g++ filename.cpp -o aliasname

Example : g++ hello.cpp -o h

To run your c++ program type

$ ./aliasname

Example : ./h

NOTE: This article is only for an Educational purpose. Any actions or activities related to the material contained on this Website is solely your responsibility.  Misuse of the information in this website can result in criminal charges brought against the persons in question. The Authors and Hackers Dormitory.will not be held responsible in the event any criminal charges be brought against any individuals misusing the information in this website to break the law.


No comments:

Thanks for coming on my blog hackersdormitory hope you like it

INSTAGRAM FEED

@_mr_rudr_