-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplay_database.c
More file actions
35 lines (30 loc) · 991 Bytes
/
display_database.c
File metadata and controls
35 lines (30 loc) · 991 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
31
32
33
34
35
#include "header.h"
void display_database(Mnode *ptr[])
{
printf("\nINDEX | WORD | FILE_COUNT | FILE_NAME : WORD_COUNT\n");
printf("----------------------------------------------------\n");
for (int i = 0; i < SIZE; i++)
{
// check index empty or not
if (ptr[i] != NULL)
{
Mnode *mtemp = ptr[i];
// loop through main nodes
while (mtemp != NULL)
{
printf("%5d | %-10s | %5d | ",
i, mtemp->word, mtemp->file_word);
// loop through sub nodes
Snode *stemp = mtemp->s_link;
while (stemp != NULL)
{
printf("%s : %d ",
stemp->file_name, stemp->word_count);
stemp = stemp->s_link;
}
printf("\n");
mtemp = mtemp->m_link;
}
}
}
}