Could someone explain to me what is a.out
and how it works?
This is the first time I am using Unix (minix).
I have one folder with two files filename.c
and test.sh
(containing three lines starting with ./a.out and some f=values).
I just want to compile and execute filename.c
if it is not?

- 83,387
- 30
- 160
- 202

- 145
- 2
- 9
-
./a.out 5 0 100 5000& ./a.out 6 0 100 5000& ./a.out 7 1 100 5000& – user2085339 Mar 01 '13 at 16:22
4 Answers
I don't use minux, so take it with a grain of salt, but it seems you should be using mcc
for compilation*:
mcc filename.c -o myprogram
chmod +x myprogram
./myprogram
The -o
option allows you to pick the exectable name so it's not defaulted to a.out
, the chmod +x
is to make sure that you have a valid exectuable (it might not be needed, but it won't hurt)

- 47,263
- 29
- 113
- 177
I use ubuntu and compile using gcc.First i write the code and say I named it testing.c .Then I save it in a folder say c. then i go command line and if currently I m not in the folder c I change it to folder c by writing
cd /c
then i compile it using gcc
gcc testing.c -o testing
then next i rung it by typing
./testing
note:-this is what i do on ubuntu when compiling using gcc.

- 29
- 7
-> To compile after saving and exiting the program(ESC :wq) at command prompt the command is CC (Your filename needs to have an extension .C)
->To run the program at command prompt you need to type ./a.out.
->To compile and run without closing your program it is (ESC) :!CC % and (ESC) :!./a.out
U can have a look at here
The Unix custom is that if you call a compiler to generate an executable, and do not give the name of the executable explicitly, the executable is called a.out
(presumably for assembler output). So:
cc -c program.c
: Just compile, givesprogram.o
cc program.c
: Compile and link, no executable name given, executable isa.out
cc -o name program.c
: Compile and link, asked explicitly to give executablename
The compilers usually are smart enough to divine the contents (and thus how to handle files) from their extensions.

- 11,412
- 8
- 32
- 52