What is pair<string,string>

I am sorry but so many STL functions are just being used without even teaching them, how is a beginner supposed to understand all of this? What is pair<string,string> and c_str???

hi @Parikalp10,
The pair container is a simple container defined in header consisting of two data elements or objects.

  • The first element is referenced as ‘first’ and the second element as ‘second’ and the order is fixed (first, second).
  • Pair is used to combine together two values which may be different in type. Pair provides a way to store two heterogeneous objects as a single unit.
  • Pair can be assigned, copied and compared. The array of objects allocated in a map or hash_map are of type ‘pair’ by default in which all the ‘first’ elements are unique keys associated with their ‘second’ value objects.
  • To access the elements, we use variable name followed by dot operator followed by the keyword first or second.

refer here for details : http://www.cplusplus.com/reference/utility/pair/

c_str() converts a C++ string into a C-style string which is essentially a null terminated array of bytes. You use it when you want to pass a C++ string into a function that expects a C-style string

regarding your issue . please tell me which course have you enrolled in , i will ask the mentor and the staffs about your concern .

Hi, thank you for this but I can find this on Google too, right? What is the use of enrolling in this course if everything is not explained? I am enrolled in C++ Master Course

We’ll take your concern into consideration. We’ll update the course content soon. for any more suggestions, please drop a mail at [email protected]

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.