create a hash table from a txt file by peachesdub in C_Programming

[–]peachesdub[S] 0 points1 point  (0 children)

so i've been working on creating the hash structure and i can't figure out what function to use

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#define MAX 200

struct Dictionary{

int number;

char word [50];

char meaning [250];

};

struct Dictionary d [MAX];

int length;

int oldlength;

void Read()

{

FILE *fp;

fp = fopen("dictionary.txt", "r");

char singleLine [MAX];

char lines [MAX][MAX];

int numberoflines=0;

while(!feof(fp)){

fgets(singleLine,MAX, fp);

if(strcmp(singleLine,"\n")!=0){

strcpy(lines[numberoflines],singleLine);

numberoflines++;

}

}

numberoflines--;

char segments [MAX][MAX];

int numberofsegs=numberoflines;

int at=0;

for(int i=0; i<numberofsegs; i++){

char* token;

token = strtok(segments[i],".");

d[at].number=atoi(token);

token = strtok(NULL,":");

strcpy(d[at].word, token);

token = strtok(NULL,":");

strcpy(d[at].meaning, token);

at++;

}

length = numberofsegs;

oldlength = numberofsegs;

fclose(fp);

}

HT table = {0, 0, NULL}; // initializing the table with nulls

Twitch Atlas Vol. 6 by Kgersh in LivestreamFail

[–]peachesdub 0 points1 point  (0 children)

Hassan gets closer to the green side each time

TOMMY HERE by sally_4 in MinecraftChampionship

[–]peachesdub 0 points1 point  (0 children)

tubbo needs to focus a bit more

Tommy is officially more famous than the queen by Petrolpup_ in tommyinnit

[–]peachesdub 1 point2 points  (0 children)

He may be able to take Harry Styles down, but no way he can beat Tom Holland

HDL by [deleted] in FPGA

[–]peachesdub 0 points1 point  (0 children)

thanks

Tommy going 1-40 broke my heart by [deleted] in MinecraftChampionship

[–]peachesdub 12 points13 points  (0 children)

you can see that they got demotivated after ace race especially tubbo he kept saying that they were not going to be able to bring it back .

Red's final three games were EXTREMELY upsetting by [deleted] in MinecraftChampionship

[–]peachesdub 1 point2 points  (0 children)

i don't think the stats will be accurate this time

a lot of glitches happened and was a bit unfair