Skip to content
Snippets Groups Projects
Select Git revision
  • 75c2c1196e1e4fe315004eefa778152c5e530591
  • main default protected
  • jw_sonar
  • v6.0.0 protected
  • update-dependencies
  • v5.0.0 protected
  • jw_sonar_backup
  • 6.0.0-dev
  • 5.0.0
  • 4.2.0
  • 4.1.1
  • 4.1.0
  • 4.0.0
  • 3.5.0
  • 3.4.0
  • 3.3.0
  • 3.2.0
  • 3.1.0
  • 3.0.0
  • 2.2.0
20 results

01_functions.yml

Blame
  • hm.h 491 B
    #ifndef _HM_H_
    #define _HM_H_
    
    #include <stdbool.h>
    
    #define MAX_LEN 80
    
    typedef enum { empty, occupied, deleted } state_t;
    
    typedef struct _cell_t {
        state_t state;
        char key[MAX_LEN];
        char value[MAX_LEN];
    } cell_t;
    
    typedef struct _hm {
        int capacity;
        cell_t *table;
    } hm;
    
    void hm_init(hm *h, int capacity);
    void hm_destroy(hm *h);
    bool hm_set(hm *h, char *key, char *value);
    char *hm_get(hm h, char *key);
    char *hm_remove(hm *h, char *key);
    void hm_print(hm h);
    
    #endif