Hashing of small dictionary
问题 I want to hash small dictionary ("dictionaries/small"). Main file compiles correctly, but at runtime it produces "Segmentation fault" message with function insert() (specifically something wrong with malloc() , but I don`t know what). HASH.c #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <ctype.h> #include <string.h> typedef struct node { char* name; struct node* next; } node; node* first[26] = {NULL}; int hash(const char* buffer) { return tolower(buffer[0]) - 'a'; }