How does it follow from running the compiler by invoking
"gcc hello.c" that one runs the program by typing "./a.out"?
umteenth_out_of_topic_post {
Because the compiler as a default will create an executable
with name a.out (derived from "assembler output") in your
working directory. In Unix a single dot (.) is shorthand for
your working directory. So typing "./a.out" (without the quotes)
tells to the operating system to execute the file in the working
directory with name a.out Of course such a file will be created
only if the compilation completed without poblems.
If dot (.) appears in your PATH variable then you can simply type
a.out If you didn't understand the last sentence you can safely
ignore it.
}
<ot>
Run a.out. man gcc for details, assuming that's your compiler.
Take further questions to comp.unix.programmer.
</ot>
I don't think that a beginner will get much out of the gcc man page.
Bill said:
% gcc hello_world.c -o hi # compile the program
% ./hi # execute the program
There is a pitfall here in that if there's already a file with name
"hi",
then the compilation command will silently overwrite it.
Spiros Bousbouras