mirror of
https://github.com/wangdoc/clang-tutorial.git
synced 2026-02-08 13:24:14 +08:00
docs(memory): fix error
This commit is contained in:
@@ -116,7 +116,7 @@ char* p = malloc(4);
|
||||
strcpy(p, "abc");
|
||||
|
||||
// or
|
||||
*p = "abc";
|
||||
p = "abc";
|
||||
```
|
||||
|
||||
上面示例中,字符指针`p`指向一段4个字节的内存,`strcpy()`将字符串“abc”拷贝放入这段内存,完成了这段内存的初始化。
|
||||
|
||||
Reference in New Issue
Block a user