我很想知道如何实现std :: string以及它与c字符串的区别?如果标准没有指定任何实现,那么任何带有解释的实现都会很好,它如何满足标准给出的字符串要求?
我无法理解C风格的字符串是什么.新年快乐
我所知道的:指针包含一个内存地址.取消引用指针将为您提供该内存位置的数据.
int x = 50;
int* ptr = &x; //pointer to an integer, holds memory address of x
cout << "&x: " << &x << endl; //these two lines give the same output as expected
cout << "ptr: " << ptr << endl;
cout << "*ptr: " << dec << (*ptr) << endl; //prints out decimal number 50
//added dec, so the program doesnt
//continue to printout hexidecimal numbers like it did for the
//the memory addresses above
cout …Run Code Online (Sandbox Code Playgroud)