Cprogramming
Cprogramming
Syntax
gedit filename
Copy (cp) -
cp sourcefile
destination_folder
History to display a
history
list of commands alreay
executed
Contatenate (cat) to
cat filename
display the contents of a
file
10
11
Man (Manual)
ls
or
ls path_to_folder
To test if a command works or not, just type that command. If command not found message
comes, then the command does not exist. Also, you can type the following
man commandname,
Eg. man gcc , to see if the command is installed. If it is, then its manual will open.
Steps to programming in C
1. Writing the code (using gedit command)
2. Compiling the code (using gcc command)
3. Executing the code ((using ./a.out ))
Writing the code
1.
2.
3.
4.
NOTE : Be sure of the location (folder) where you are saving your work
Compiling the code
1.
2.
3.
4.
NOTE : There are two types of errors. One are WARNINGS. Warnigns are just informative
messages, and can be ignored. Other is ERROR. Errors are mistakes in the C program, that need
to be removed before the program can be executed. So edit the program. The line number is
mentioned in the error message. Go to the line number and look for the error.
Executing the code
1. type ./a.out
2. the output is displayed on the screen
NOTE : If you have compiled using step 4 in compiling, then you should type ./filename, like
./hello in the example case.