相关疑难解决方法(0)

如何实现std :: string?

我很想知道如何实现std :: string以及它与c字符串的区别?如果标准没有指定任何实现,那么任何带有解释的实现都会很好,它如何满足标准给出的字符串要求?

c++ string std cstring

53
推荐指数
4
解决办法
5万
查看次数

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)

c c++ arrays string pointers

11
推荐指数
2
解决办法
8538
查看次数

标签 统计

c++ ×2

string ×2

arrays ×1

c ×1

cstring ×1

pointers ×1

std ×1