ITSEC
LAB
REPORT: 1
BY – AMANUEL LEGESSE
SOFTWARE ENG. EXT
ID – ATE/3628/1
System Programming Laboratory 3: C
Basics
Practical 1: Procedures: How to use C
programming in UNIX operating system.
After creating hello.C the file was submitted to GCC
(the GNU C Compiler).
The program is placed in the file as hello.C.
When the program is run with the command
hello.out the following result is displayed
Practical 2: Understanding the role and
function of pre-processor, compiler,
assembler and linker.
1. Writint the following C header file and saved it
using the name head.h.
extern int x = 25;
The following C program was written and saved as
test.C
Excersise 3. The file created is a preprocessor output of
test.c and performs primary transformation of test.c using
lexical analysis and a test.i file is created.
4. and a test.s file is created.
5. and a test.o file is created.
6. and a test file is created.
Practical 3: working and linking with more than one C programs.
1. The following header was saved using the name head.h
2. The following code was saved using the name main.c.
3. The following code was saved as swap.c
4.
Excersise 1: . Were you able to run the program? What do you think is the problem?
I was unable to run the program and I believe the problem is that I am trying to compile
main.c file but swap function is in another file the reason why I am getting an undefined
reference error.
2. In which phase do you think the problem happened?
Swap(), display() and main() declared as void are the phase which the problem occurred.
3. Try to pre-process, compile and assemble the files separately. Were there problems?
There were no problems
5. Try to link the output of the assembler for the two programs and try to run the program? Did
the problem get resolved?
The problem has been resolved
Exercises: Writing different C programs
Exercise 1: In this lab exercise, you will create a program that computes the distance an object will fall in
Earth's gravity.
1: Created GravityCalculator.c
2.
3. The object's position after 10.000000 seconds is
0.000000 meters[06/20/23]
Exercise 2: Modifying the program then running it.
Excersise 3:
Laboratory 6: Structures in C