Linux - Algunos ejercicios sobre linux!

 
Vista:

Algunos ejercicios sobre linux!

Publicado por jormuocu (1 intervención) el 24/01/2005 13:10:42
Me podrias ayudar a resolver cuantos mas mejor de estos ejercicicios?

mandame la respuesta: [email protected]

Gracias!

Exercise set 1

Deadline for this excercise set is February 1st 23:59.

1.1 (1 point) Explain what the following command lines do, what is the
meaning of each argument and option.
a) gcc -Wall hello.c -o hello
b) ar crv name1.a name2.o name3.c
c) gcc dos_cvrt.o -L. -ltest -o dos_cvrt

1.2 (1 point) What is wrong with the following commands.
a) gcc -c hello.c -o hello
b) ar qi file.a file
c) gcc -l -m file.o

1.3 (1 point) Explain each string\'s meaning in the following make file. What
kind of parameters can you pass to make utility.

# $Source: /home/student/project/Makefile,v $

CC= gcc
STD= _GNU_SOURCE
OBJS= object1.o object2.o

.c.o:
$(CC) -c -Wall $(CFLAGS) -D$(STD) $<

all: name1 name2

test: all
name1 input1 >testfile

name1: $(OBJS)

$(CC) $(OBJS) -o name2

name2: name1
rm -f
ln name1 name2

name1.h: header1.h header2.h
touch [email protected]

clean:
rm -f *.o core

clobber: clean
rm -f name1 name2

# End Makefile

1.4 (1 point) Precedence of C operators.
a) Insert parenthesis to the following expression to make the precedence
of the operators explicit:
! a -= b == c ++ && * d ++ / -- g

b) Remove as many parenthesis from the following expression without changing
the evaluation order:
a%= ((((a<2) & (b>>3)) & 15) && (c))

c) Complete the following function that computes the factorial.

double factorial(int n)
{ double result;
...
for(...)
...
}

1.5 (2 points) Write a C program that accepts an arbitrary number of file
names as command line parameters, opens the files, counts the number
of characters in them, and prints the file name and size to stdout.
The program must handle the errors in opening the files and
issue proper error messages.

#include <stdio.h>
#include <errno.h>
...

int main(int argc, char *argv[]) {
...
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder