-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
59 lines (51 loc) · 1.18 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <stdio.h>
#include <assert.h>
#include "arith.h"
#include <stdlib.h>
#include <string.h>
#include "except.h"
#include "mem.h"
#include "stack.h"
#include "queue.h"
#include "list.h"
#include "atom.h"
#include <time.h>
Except_T FileOpen_failed = {"FILE OPEN FAILED"};
typedef struct _node{
char *name;
struct _node *next;
}node;
node* head;
void newNode(const char *n){
node *ptr;
ptr = ALLOC(sizeof(node));
ptr->name = ALLOC(80);
ptr->next = head->next;
head->next = ptr;
ptr->name=strcpy(ptr->name,n);
}
void applyPrint(void **ptr,void *cl){
printf("%s\n",(char*)*ptr);
}
int main(int32_t argc, char const *argv[]){
uint32_t i;
const char *strn;
clock_t begin,end;
double time_spent;
char **buf;
List_T lista;
strn="paparia";
begin=clock();
for(i=0; i<1000; i++){
Atom_new(strn,7);
}
end=clock();
time_spent=(double)(end-begin)/CLOCKS_PER_SEC;
printf("%f\n",time_spent);
buf=ALLOC(10*sizeof(char*));
buf[0]="PEOS";
lista=List_list("arxodoa", "malakies", "kala", NULL);
printf("%d\n",List_length(lista));
List_map(lista,applyPrint,NULL);
return 0;
}