Skip to content
Loading
  • Rajanikant Hawaldar
    +2
    array of pointers?
    +2
  • Rajanikant Hawaldar
    +2
    you don't just add std::string to an array of pointers to char
    +2
  • Rajanikant Hawaldar
    +2
    1. char *yxstr = yx.c_str(); <--Good way to shoot yourself in the foot  
    +2
  • Rajanikant Hawaldar
    +2
    Consider below
    1. std::string x = "Dd";  
    2. std::string yx = "xx";  
    3. std::vector str_arr;  
    4.   
    5. str_arr.emplace_back(std::move(x));  
    6. str_arr.emplace_back(std::move(yx));  
     
    +2
  • +1
    yes, how i can add pointer to this array ?
    +1
  • +1
    good, and now i want to add std::string to array
    +1
  • +1
    std::string x = "Dd"; std::string yx = "xx"; char* strPointer[2]; Can i add x and yx variable to strPointer ? char *yxstr = yx.c_str();
    +1
  • +1
    Let me check
    +1