I tried to create a tree.The structure definition is given.But when assigning values to id, gateType an error is coming-"Request for gateType not in structure or union".I have dynamically allocated memory for each node.A text file is being read which is not of much concern with this question.Please help.
void tree(FILE *file);
struct node
{
char gateType[5];
int id;
struct node *input[20];
struct node *output[10];
};
void main()
{
FILE *f,*temp;
f=fopen("c17.bench","r");
tree(f);
fclose ( f);
}
void tree(FILE *file)
{
while(fgets(line,sizeof(line),file) != NULL)
{
if(line[0] != '#' || line[0] != ' ')
{
node *temp = (struct node *)malloc(sizeof(struct node));
//temp->gateType="and";
temp -> id = 5;
}
}
}