Phil vor 7 Jahren
Commit
2011c5cf3a
4 geänderte Dateien mit 80 neuen und 0 gelöschten Zeilen
  1. BIN
      LaborAI.pdf
  2. BIN
      listen
  3. 59 0
      listen.c
  4. 21 0
      rand_seq.c

BIN
LaborAI.pdf


BIN
listen


+ 59 - 0
listen.c

@@ -0,0 +1,59 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+//type dfinitions
+typedef struct lin_list
+	{
+	char *value;
+	struct lin_list *next;
+	}LinListCell, *LinList_p;
+
+//function derfinitions
+
+LinList_p LinListAllocCell(char* value);
+void LinListFreeCell(LinList_p junk);
+void LinListFree(LinList_p *junk);
+LinList_p LinListInsertFirst(LinList_p anchor,LinList_p newCell);
+
+int main(void)
+{
+	printf("blaa\n");
+	LinList_p anchor = LinListAllocCell("xx");
+	anchor->next =  LinListAllocCell("xc");
+	printf("anchor=%p\n",anchor);
+	printf("%p %p \n", anchor->value,anchor->next->value);
+}
+
+LinList_p LinListInsertFirst(LinList_p anchor,LinList_p newCell)
+{
+	LinListCell *buff = anchor;
+	anchor = LinListAllocCell("");
+	anchor->next = buff;
+}
+
+LinList_p LinListAllocCell(char* value)
+
+{
+	LinList_p newcell = malloc(sizeof(LinListCell));
+	newcell->next = NULL;
+	newcell->value = strdup(value);
+	return newcell;
+}
+
+
+void LinListFreeCell(LinList_p junk)
+{
+	free(junk);
+}
+
+void LinListFree(LinList_p *junk)
+{
+	LinListCell  *next = junk;
+	LinListCell *buff;
+	*junk = NULL;
+	while(next != NULL)
+	{
+		buff = next->next;
+		free(next);
+	}
+}

+ 21 - 0
rand_seq.c

@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#define MAXNUM 1000
+#define MAXITEMS 10000
+
+int main(int argc, char *argv[])
+{
+
+if(argc > 2)
+{
+	printf("Bla error \n");
+}
+int i;
+printf("%i \n",(int)argv[1]);
+int target = 0; // (int) argv[1];
+for(i = 0; i < target;i++)
+{
+	printf("%i \n",rand() % MAXNUM);
+}
+}