【语法】sizeof 笔记
来源:互联网 发布:python常用函数 编辑:程序博客网 时间:2024/06/04 19:46
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
...{
cout << "sizeof(string) = " << sizeof(string) << endl;
string str[] = ...{"sdf4", "123", "d"};
string str4[4] = ...{"str33", "mmmmm"};
cout << "sizeof(str) = " << sizeof(str) << endl;
cout << "sizeof(str4) = " << sizeof(str4) << endl;
string *pStr = new string[2];
pStr[0] = "us";
pStr[1] = "cn";
cout << endl;
cout << "sizeof(pStr) = " << sizeof(pStr) << endl;
cout << "sizeof(*pStr) = " << sizeof(*pStr) << endl;
cout << endl;
char b[] = "fcdg123";
cout << "b = " << b << endl;
cout << "sizeof(b) = " << sizeof(b) << endl;
cout << "*b = "<< *b << endl;
cout << "sizeof(*b) =" << sizeof(*b) << endl;
cout << endl;
char *c = "fcdg123";
cout << "c = " << c << endl;
cout << "sizeof(c) = " << sizeof(c) << endl;
cout << "*c = "<< *c << endl;
cout << "sizeof(*c) =" << sizeof(*c) << endl;
return;
}
#include <string>
using namespace std;
int main(int argc, char* argv[])
...{
cout << "sizeof(string) = " << sizeof(string) << endl;
string str[] = ...{"sdf4", "123", "d"};
string str4[4] = ...{"str33", "mmmmm"};
cout << "sizeof(str) = " << sizeof(str) << endl;
cout << "sizeof(str4) = " << sizeof(str4) << endl;
string *pStr = new string[2];
pStr[0] = "us";
pStr[1] = "cn";
cout << endl;
cout << "sizeof(pStr) = " << sizeof(pStr) << endl;
cout << "sizeof(*pStr) = " << sizeof(*pStr) << endl;
cout << endl;
char b[] = "fcdg123";
cout << "b = " << b << endl;
cout << "sizeof(b) = " << sizeof(b) << endl;
cout << "*b = "<< *b << endl;
cout << "sizeof(*b) =" << sizeof(*b) << endl;
cout << endl;
char *c = "fcdg123";
cout << "c = " << c << endl;
cout << "sizeof(c) = " << sizeof(c) << endl;
cout << "*c = "<< *c << endl;
cout << "sizeof(*c) =" << sizeof(*c) << endl;
return;
}
sizeof(string) = 16
sizeof(str) = 48
sizeof(str4) = 64
sizeof(pStr) = 4
sizeof(*pStr) = 16
b = fcdg123
sizeof(b) = 8
*b = f
sizeof(*b) =1
c = fcdg123
sizeof(c) = 4
*c = f
sizeof(*c) =1
sizeof(str) = 48
sizeof(str4) = 64
sizeof(pStr) = 4
sizeof(*pStr) = 16
b = fcdg123
sizeof(b) = 8
*b = f
sizeof(*b) =1
c = fcdg123
sizeof(c) = 4
*c = f
sizeof(*c) =1
- 【语法】sizeof 笔记
- sizeof语法
- sizeof语法
- 【语法】sizeof和strlen
- 笔记sizeof
- sizeof的学习笔记
- 【C#笔记】sizeof()
- sizeof 解惑笔记
- 【C#笔记】sizeof()
- 语法笔记
- 类的sizeof - 学习笔记
- 《c专家编程》笔记--sizeof
- 【笔记】Velocity 语法笔记
- c++ 基础语法一(空类型的sizeof)
- SIZEOF
- Sizeof
- sizeof
- sizeof
- ReportX技巧(9)输入控制
- 刚用seam做了一个级联下拉列表的例子
- vb与c#的语法比较
- windows核心编程2
- 计算消息摘要实例、各种加密实例
- 【语法】sizeof 笔记
- 2007年最令人失望的九大新兴技术出炉
- 哈佛大学图书馆上的警句
- Ajax Control Toolkit 34个服务器端控件
- 多边形的重心(转)
- document.getElementById("divv").style.display = 'none';
- 在VC6工程的Picture控件上显示JPG等图片,且图片随控件大小改变
- jsf简介
- Getting the Preferred Audio Device Number