Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct Queue
- {
- char Name[80], Phone[80], Email[80];
- struct Node *head;
- struct Node *next;
- } Queue;
- Node *front(Queue q);
- {
- if (q.head == NULL)
- return;
- return q.head;
- }
- Queue* makeQueue()
- {
- Queue* q;
- q = (Queue *)malloc(sizeof(Queue));
- q->head = NULL;
- return q;
- }
- void pop(Queue *q)
- {
- Node *tmp;
- if (q.head == NULL)
- {
- printf("ERROR\n");
- return;
- }
- Node *tmp = q.head;
- q.head = q.head->next;
- free(tmp);
- }
- void push(Queue *q)
- {
- Node *iterator;
- if (q.head == NULL)
- return;
- Node *iterator = q.head;
- while (iterator->next != NULL)
- {
- iterator = iterator->next;
- }
- iterator->next = p;
- return;
- }
- int main()
- {
- FILE *f;
- f = fopen("phonebook.txt", "r");
- if (f == NULL)
- {
- printf("ERROR");
- }
- else
- {
- char s1[80], s2[80], s3[80];
- do
- {
- fscanf(f, "%s %s %s", s1, s2, s3);
- Node* newNode = makeNode(s1,s2,s3);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment