Original Post
Hi I want to store pair in a multimap. If i print the contents of the multimap, it prints the blank string. It is happening becoz while storing int value in an character array, first character encountered is null while printing. Is there any way of passing character array of fixed length in a multimap irrespective of any null in between? see prog: std::multimap *objmap2=NULL; std::multimap* populatemap() { std::multimap *objmap=NULL; objmap=new std::multimap; char a[5]; int at=7021709; memcpy(a,&at,sizeof(int)); a[4]='\0'; std::pair p1(20,a); objmap->insert(p1); return objmap; } main() { objmap2=populatemap(); std::pair::iterator , std::multimap::iterator> retPair; retPair = objmap2->equal_range(20); std::multimap::iterator currIter = retPair.first; while ( currIter != retPair.second) { cout<<" value : " << (*currIter).second << endl; currIter++; } }