What I understand from your question is that you are writing a program in the C Programming Language and you want to run it, right?
C is a compiled language. This means that the code you write (i.e., the source code) needs to be translated to machine code before you can run it. This process is known as compiling and it is an essential step to generate a program that can run natively on your architecture. In other words, compiling your source code will result in an executable file that can be understood by both your operating system and your processor.
The alternative to compiled languages is interpreted languages. Examples of interpreted languages are Python and JavaScript. Interpreted languages don't need to be compiled, but you need to have a program (the interpreter) in order to run your programs. If you are using an interpreted language, your programs will be text files that are understood by the interpreter, as opposed to the executable files produced by the compiler. For further details on compiled vs interpreted languages, refer to this thread.
It looks to me that you are trying to skip the compiling step that C requires. When you do ./browninz.adventure.c
, your shell will try to interpret the source code as if it were Bash code (assuming that your shell is Bash). To actually run the program, first, you will need to compile it. Your system may come with a compiler installed, such as GCC in GNU/Linux. Otherwise, you will need to find and install a compiler.
Assuming that you have GCC installed, you can compile your source code by running:
gcc -o my_program browninz.adventure.c
This will generate an executable file called my_program
, that you can run as follows:
./my_program
That should produce the results that you expect. To get more information of GCC command line options, you can refer to the GCC man pages:
man gcc
I hope this helps!