--- /dev/null
+CC=gcc
+CFLAGS=-Wall -ansi -pedantic
+
+EXECS=ex1 ex2
+EX1OBJ=ex1.o aux.o
+EX2OBJ=ex2.o aux.o
+
+
+all: ${EXECS}
+
+ex1: ${EX1OBJ} aux.h
+ gcc ${CFLAGS} -o $@ ${EX1OBJ}
+
+ex2: ${EX2OBJ} aux.h
+ gcc ${CFLAGS} -o $@ ${EX2OBJ}
+
+clean:
+ rm -f *.o ${EXECS}
--- /dev/null
+#include <stdio.h>
+
+void leVector (int v[], int tamanho) {
+ int k;
+ for (k = 0; k < tamanho; k++)
+ scanf("%d", &v[k]);
+}
+
+void escreveVector(int v[], int tamanho) {
+ int k;
+ for (k = 0; k < tamanho; k++)
+ printf("%d\n", v[k]);
+}
+
--- /dev/null
+#ifndef AUX_H
+#define AUX_H
+
+void leVector (int v[], int tamanho);
+void escreveVector(int v[], int tamanho);
+
+#endif /* AUX_H */
#include <stdio.h>
+#include "aux.h"
#define NUMELEMS 5
-void leVector (int v[], int tamanho);
-void escreveVector(int v[], int tamanho);
-
int main() {
int v[NUMELEMS];
return 0;
}
-void leVector (int v[], int tamanho) {
- int k;
- for (k = 0; k < tamanho; k++)
- scanf("%d", &v[k]);
-}
-
-void escreveVector(int v[], int tamanho) {
- int k;
- for (k = 0; k < tamanho; k++)
- printf("%d\n", v[k]);
-}
-
#include <stdio.h>
+#include "aux.h"
#define NUMELEMS 100
-void leVector(int a[], int tam);
int somaVector(int a[], int tam);
int main() {
return 0;
}
-void leVector(int a[], int tam) {
- int i;
-
- for (i = 0; i < tam; i++)
- scanf("%d", &a[i]);
-}
-
int somaVector(int a[], int tam) {
int i, soma = 0;