// studystring.cpp :
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
cout<<"char,char*,string 在C++中的占几个字节: -------------------------"<<endl;
cout<<"sizeof(char) = "<<sizeof(char)<<endl; //=1
cout<<"sizeof(char*) = "<<sizeof(char*)<<endl; //=4
cout<<"sizeof(string) = "<<sizeof(string)<<endl; //=16
cout<<"----------------------------------------------------------------"<<endl;
cout<<endl;cout<<endl;
string str;
str = "12345678912"; // 11个字符
cout<<"the size of str = "<<sizeof(str)<<endl; // = 16
cout<<"the length of str = "<<str.length()<<endl;// = 11
cout<<"---------