CPlusPlusThings/practical_exercises/key_exercises/动态数组.cpp
Light-City a4d828bb4c update
2020-04-06 00:57:02 +08:00

5 lines
128 B
C++

#include<iostream>
char *sPtr; //存放字符串的指针
s="哈哈"
sPtr = new char[strlen(s)+1];
strncpy(sPtr,s;