Node:Basic ideas, Next:The compiler, Previous:Using a compiler, Up:Using a compiler
First a note about a programming language that is different from the C programming language, the GNU shell. When you enter commands in the GNU shell, they are executed immediately. Moreover, the shell is a programming language, in that the commands you type are a program, because you can also create a text file containing many shell commands. When you run this file, the commands will be executed in sequence.
On the other hand, consider C. While a shell command file can be executed directly, a C program must be created in two stages:
To run the compiled program, you must usually type the name of the
executable file preceded by a period and a slash, as in this example:
./myprogram
The "dot-slash" prefix tells the GNU shell to look in the current
directory for the executable. You usually do not need to type ./
in front of commands for programs that came with your GNU system, such
as emacs
, because the computer already knows where to
look for the executables of those programs, which were placed in special
directories when your GNU system was installed.
A C program is made up of, among other components, variables and functions. A variable is a way to hold some data which may vary, hence the name. For example, a variable might hold the number 17, and later the number 41. Another variable might hold the word "Sue".
A function is a segment of text in the source code of a program that tells the computer what to do. Programming consists, in large part, of writing functions.