فهرست منبع

useless stuff

Phil 7 سال پیش
والد
کامیت
2723102a81
1فایلهای تغییر یافته به همراه28 افزوده شده و 1 حذف شده
  1. 28 1
      listen.c

+ 28 - 1
listen.c

@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 //type dfinitions
 typedef struct lin_list
@@ -14,16 +15,42 @@ LinList_p LinListAllocCell(char* value);
 void LinListFreeCell(LinList_p junk);
 void LinListFree(LinList_p *junk);
 LinList_p LinListInsertFirst(LinList_p anchor,LinList_p newCell);
+LinList_p LinListExtractFirst(LinList_p *anchor);
+LinList_p LinListFind(LinList_p anchor, char* value);
 
 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 LinListFind(LinList_p anchor, char* value)
+{
+LinList_p cell = anchor;
+while(cell != NULL)
+	{
+	if(strcmp(value, cell->value)!=0)
+		{
+		return NULL;
+		}else
+		{
+		return cell;
+		}
+	cell = cell->next;
+	}
+}
+
+
+LinList_p LinListExtractFirst(LinList_p *anchor)
+{
+LinList_p buff = anchor;
+*anchor = anchor->next
+return buff;
+}
+
 LinList_p LinListInsertFirst(LinList_p anchor,LinList_p newCell)
 {
 	LinListCell *buff = anchor;