DEV Community

Discussion on: How To Run C Programs on Android

 
bauripalash profile image
Palash Bauri 👻

C is a compiled language and It seems simple.c is compiled.
Just Run the binary simple with $ ./simple

Thread Thread
 
koouty profile image
Kouty

It works! So, if I understand, after the clang action, A compiled file is created, and I need to open it with prompting it, the same name of file without the ".c" at the end of the name. And to make this I need to type "./filename". Right?

Thread Thread
 
bauripalash profile image
Palash Bauri 👻 • Edited

Partially.
Look, C is a compiled langauge, and Clang is a compiler unlike Python or Ruby which are interpreted language.

When you type the command clang simple.c , clang takes the source code and compiles it into machine code into a.out (a.out is default output name) and to run the program you must execute the binary like this $ ./a.out

And you can name the output binary anything you like by simply passing the -o flag, the syntax is like this :

$clang <SOURCE_CODE> -o <OUTPUT_NAME>

Thread Thread
 
bauripalash profile image
Palash Bauri 👻

@koouty , seems like you're new to C , I would recommend watching some Beginners' Tutorial and Reading some tutorials available on internet.

Thread Thread
 
koouty profile image
Kouty

Many many thanks.

Thread Thread
 
bauripalash profile image
Palash Bauri 👻

If any need any further help you can just DM me

Thread Thread
 
koouty profile image
Kouty

👍