标签:
#include<iostream>
using namespace std;
int main() {
char a[] = "abcdefg";
string s = a;
int len = sizeof(a); //len = 8;
int len_s = sizeof(s); // len_s = 28;
int lenth = s.size(); //lenth = 7;
int lenth_a = strlen(a);// lenth_a = 7
int lenth_s = strlen(s); // 错误的
cout << len <<" " <<len_s <<" " << lenth ;
system("pause");
}
标签:
原文地址:http://www.cnblogs.com/wj0816/p/5840650.html