Answers for "kmap c code"

C++
2

map declaration c++

//assuming your variables are called : variables_
#include <map>
#include <string>

std::map<int, std::string> map_;
map_[1] = "mercury";
map_[2] = "mars";
map_.insert(std::make_pair(3, "earth"));
//either synthax works to declare a new entry

return map_[2]; //here, map_[2] will return "mars"
Posted by: Guest on July-12-2020
1

map in c

#include <map>

std::map<size_t, std::string> map;

map[10] = "Hello";
map[1] = "boys";
map[901] = "girls"
Posted by: Guest on October-06-2020

Browse Popular Code Answers by Language