I am doing my term paper on airport simulations, and I am having problems trying to save information in part of an array of characters.
I have to enter a character string and it will be stored in planeNamethe node part, but it cannot work. Mine is int main()now pretty empty because I didn’t want to continue coding with the wrong functions.
Below are my codes:
struct node {
char planeName[5];
int planeNumber;
struct node* next;
};
struct node* front = NULL;
struct node* rear = NULL;
void Enqueue(char name[5], int x);
int main() {
}
void Enqueue(char name[5], int x){
struct node* temp = (struct node*)malloc(sizeof(struct node));
temp -> planeName = name;
temp -> planeNumber = x;
temp -> next = NULL;
if (front == NULL && rear == NULL)
front = rear = temp;
rear -> next = temp;
rear = temp;
return;
}
This is an error message on a line containing:temp -> planeName = name
This is the part where the error message appears, and I do not know why this is happening.
Can someone please help and ask me more questions if my question is not clear enough?
source
share