Skip to content
Snippets Groups Projects
Select Git revision
  • ae80154998ab8643f8cecb54745fe70b331dab32
  • main default protected
  • develop
3 results

main.c

Blame
  • main.c 1.52 KiB
    /* Author : Dario GENGA
     * Date : 18.01.2022
     * Description : Hash library.
     */
    
    #include <stdio.h>
    #include <stdlib.h>
    #include "hashtable.h"
    
    int main() {
        hm *hashmap = hm_create(10);
        hm_set(hashmap, "Key1", "Value1");
        hm_set(hashmap, "Key2", "Value1");
        hm_set(hashmap, "Key1", "Value2");
        hm_set(hashmap, "Key3", "Value1");
        hm_set(hashmap, "Key4", "FOUR");
        hm_set(hashmap, "Key1", "Value3");
        hm_set(hashmap, "Key5", "I think it's good now");
        hm_set(hashmap, "Key6", "6");
        hm_set(hashmap, "Key7", "7");
        hm_set(hashmap, "Key8", "8");
        hm_set(hashmap, "Key9", "9");
        hm_set(hashmap, "Key27", "MORE ?");
        hm_set(hashmap, "Key10", "Is this the end ?");
    
        printf("Value of %s : %s\n", "Key1", hm_get(hashmap, "Key1"));
        printf("Value of %s : %s\n", "Key2", hm_get(hashmap, "Key2"));
        printf("Value of %s : %s\n", "Key3", hm_get(hashmap, "Key3"));
        printf("Value of %s : %s\n", "Key4", hm_get(hashmap, "Key4"));
        printf("Value of %s : %s\n", "Key5", hm_get(hashmap, "Key5"));
        printf("Value of %s : %s\n", "Key6", hm_get(hashmap, "Key6"));
        printf("Value of %s : %s\n", "Key7", hm_get(hashmap, "Key7"));
        printf("Value of %s : %s\n", "Key8", hm_get(hashmap, "Key8"));
        printf("Value of %s : %s\n", "Key9", hm_get(hashmap, "Key9"));
        printf("Value of %s : %s\n", "Key10", hm_get(hashmap, "Key10"));
    
        hm_print(hashmap);
        hm_rm(hashmap, "Key1");
        hm_print(hashmap);
        hm_rm(hashmap, "Key10");
        hm_print(hashmap);
    
        hm_destroy(&hashmap);
    
        return EXIT_SUCCESS;
    }