Suicidaleggroll, consider that they're learning, trying stuff, yes their questions are "off" or misplaced, however in contrast to my original recommendation, even though this fits with a software forum, they rightly did put a question to the newbie forum because ... they're new at this.
Sud_paddy, as Suicidaleggroll is pointing out, you do not need an argument, at least in this example case.
The default result of a gcc compile is "a.out" which is an executable. You run it as shown in Suicidaleggroll's response.
If you change the output file using the -o directive, then the chosen name is the executable.
To run a C program executable, you call the name of it; however if the current working directory is not in your $PATH, then you need to use "./" before the name, as you have been using.
If you were to structure a C program with an argument list, the program could require passing arguments.
For example:
Code:
#include <stdio.h>
void main(int argc, char **argv)
{
// Code
}
This is the basic form to "create" a C executable which "supports" arguments. However if the code in that file doesn't use or check the arguments, then the program will still run. The author of the code can check the value of argc, it tells the number of arguments which were passed when the program was run. Using the **argv string array pointer, one can extract the arguments, or the arguments can also be grabbed using other means; such as getopt(3).
When I say getopt(3), because if you try to obtain the manpage for getopt, you will get getopt(1) as the first one. And that's the command line version of getopt. If you either do:
or:
then you will see either "the" specific one you want, or you'll see all available man pages related to getopt, that your system knows about.
I think I'd recommend a few things here.
1. It seems as if you're experimenting with C programming and command line compilation. Refer to some of these:
http://www.linfo.org/create_c1.html
http://www.linfo.org/create_c2.html
2. Bear in mind that although at the start, a lot of it is "do this", "next do this" the whole point of introductory tutorials are that you learn the basics and then be able to grow from there.
3. Next you ought to learn sufficient information about the Linux command shell. Learn about the $PATH environment, file privileges and so forth. Try this link:
http://linuxcommand.org/learning_the_shell.php
Reference (3) will help you to understand how to enter commands, know what to do with them, and understand what file permissions, ownership mean to you.
Best of luck. Once you get through this stepping stone and can run the code you originally intended to run, you probably should mark this thread as solved and create new threads with further questions. But do make sure you understand enough to get your answer now before closing this thread.