i have function defines number, , want use number call item in hashmap, based on zero-based index. similar to how call array item: arr[0];
do hash maps use 0 based index numbering?
trying keep point, let me know if need more details.
do hash maps use 0 based index numbering?
trying keep point, let me know if need more details.
code: [select]
#include <hashmap.h>
//define max size of hashtable
const byte hash_size = 5;
//storage
hashtype<char*, int> hashrawarray[hash_size];
//handles storage [search,retrieve,insert]
hashmap<char*, int> hashmap = hashmap<char*, int>( hashrawarray , hash_size );
void setup() {
//setup hashmap
hashmap[0]("name", 18);
hashmap[1]("test", 200);
hashmap[2]("qwer", 1234);
hashmap[3]("abc", 123);
hashmap[4]("alphabeta", 20);
serial.begin(9600);
// hashmap.debug();
}
void loop() {
serial.println( hashmap.getindexof("test") );
serial.println( hashmap.getvalueof("test") );
delay (1000);
}
quote
do hash maps use 0 based index numbering?does matter? don't access data in hash table directly.
did try it, see?
Arduino Forum > Using Arduino > Programming Questions > HashMap Print by Index number
arduino
Comments
Post a Comment