#include <string>
using namespace std;
int main()
{
string Str {"Stackoverflow"};
unsigned char const *Ptr = &Str.front();
unsigned char const *BufLim = &Str.back();
cout<<ptr;
cout<<BufLim;
return 0;
}
The above code is not compiling, I'm getting:
error: invalid conversion from ‘__gnu_cxx::__alloc_traits, char>::value_type*’ {aka ‘char*’} to ‘const unsigned char*’
I want to assign a string's initial character and the last character to a pointer of type unsigned char const.
Kindly help me on this.