Q:

strange output of STL map

C programmer trying to call a C++ map (to use the functionality of an associated array or hashing).
The string is just a beginning, will go on to hash binary string.  Got stuck on the first step.  Wonder why the output of this program will only return 0. 
#include <string.h>
#include <iostream>
#include <map>
#include <utility>
#include <stdio.h>

using namespace std;

extern "C" {
int get(map<string, int> e, char* s){
    return e[s];
}
int set(map<string, int> e, char* s, int value) {
    e[s] = value;
}
}

int main()
{
   map<string, int> Employees;
    printf("size is %d\n", sizeof(Employees));
   set(Employees, "jin", 100);
   set(Employees, "joe", 101);
   set(Employees, "john", 102);
   set(Employees, "jerry", 103);
   set(Employees, "jobs", 1004);
    printf("value %d\n", get(Employees, "joe"));

}

Thanks.

A:

Two bugs found (yet):
printf("size is %d\n", sizeof(Employees));

has to be 
printf("size is %d\n", Employees.size());

sizeof gives you the size of the object, not the count of elements within.

int set(map<string, int> e, char* s, int value) 

has to be 
int set(map<string, int> &e, char* s, int value)

otherwise you give a copy to the function, not the original (as in C).The copy will be discard after leaving the scope of the function. The original is not altered.

