Selaa lähdekoodia

These files need to be reworked

Lorenz Bung 8 vuotta sitten
vanhempi
commit
8b7b3abad7
2 muutettua tiedostoa jossa 18 lisäystä ja 0 poistoa
  1. 11
    0
      hw2/simu1/Makefile
  2. 7
    0
      hw2/simu1/intArray1.c

+ 11
- 0
hw2/simu1/Makefile Näytä tiedosto

@@ -0,0 +1,11 @@
1
+CC=gcc
2
+CFLAGS=-g
3
+RM=rm -f
4
+TARGET=null malloc intArray1 intArray2 free
5
+.PHONY: all clean
6
+all: $(TARGET)
7
+clean:
8
+	$(RM) null malloc intArray1 intArray2 free
9
+
10
+$(TARGET): $(TARGET).c
11
+	$(CC) $< $(CFLAGS) -o $@

+ 7
- 0
hw2/simu1/intArray1.c Näytä tiedosto

@@ -0,0 +1,7 @@
1
+/* intArray1.c */
2
+#include <stdlib.h>
3
+int main(char* argv[], int argc) {
4
+  int* intArray = malloc(100 * sizeof(int));
5
+  intArray[100] = 0;
6
+  free(intArray);
7
+}

Loading…
Peruuta
Tallenna