-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaa.c
More file actions
30 lines (30 loc) · 737 Bytes
/
Copy pathaa.c
File metadata and controls
30 lines (30 loc) · 737 Bytes
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
struct ASTNode *TreeCreate(struct Typetable* type,int nodetype,char* name,union Constant *value,struct ASTNode *arglist,
struct ASTNode *ptr1,struct ASTNode *ptr2,struct ASTNode *ptr3)
{
struct ASTNode * temp;
temp = (struct ASTNode *) malloc(sizeof(struct ASTNode));
temp -> type = type;
temp -> nodetype = nodetype;
if(name != NULL)
{
temp -> name = (char *)malloc(sizeof(name));
strcpy(temp -> name,name);
}
else
{
temp -> name = NULL;
}
if (value != NULL)
{
temp -> value.intval = value -> intval;
}
else
{
temp -> value.strval = NULL;
}
temp -> arglist = arglist;
temp -> ptr1 = ptr1;
temp -> ptr2 = ptr2;
temp -> ptr3 = ptr3;
return temp;
}