best way to store linked data

hello guys,
i would like to store custom data for my algorithm, I want to store linked data (equivalence)

the structure in memory :

char* <-----> unsigned char*
char* <-----> unsigned char*
char* <-----> unsigned char*
char* <-----> unsigned char*

its to store a md5 to its equivalent but not hashed

what the best way in c/c++ ??

I think i will go with struct in C yes or no ?

thanks

struct mystructure

{

unsigned char* hash;

char* plaintext;

};

??
Last edited on
what the best way in c/c++ ??
I think i will go with struct in C yes or no ?

Perhaps?
The best way it’s the one which suits your code. And there’s no rule which says the best way in C is the same in C++, so you’d better decide if you’re going to write a code in C or in C++.
I love standard library, so I think I’d go with a std::vector<std::pair<std::string, std::string>>, but another one could give a totally different answer.
Registered users can post here. Sign in or register to post.