只需一步,快速开始
需要三步,才能开始
只需两步,慢速开始
欧卡2
游戏时长 547 小时
美卡
游戏时长 2 小时
/* * File: main.cpp * Author: annhe * * Created on 201年月日, : */ #include <cstdlib> #include <iostream> using namespace std; void foo(char buf3[20]) { cout<<sizeof(buf3[20]); } int main(int argc, char* argv[]) { char *buf = "hello world"; char buf2[20] = "hello world"; cout<<sizeof(buf)<<endl<<sizeof(buf2)<<endl<<sizeof("hello world")<<endl; foo("hello world"); return 0; }
$ ./sizeof.exe 4 //sizeof buf 是求一个指针的存储空间大小,都是4 20 //数组名不是做右值,计算结果是整个数组存储空间的大小 12 //字符串的大小 1 //字符的大小,buf[20]只有一个字节
使用道具 举报
本版积分规则 发表回复 回帖后跳转到最后一页
客服QQ936487697|联系我们|手机版|欧卡2中国 ( 湘ICP备11020288号-1 ) 复制应用客服QQ号,请添加QQ好友后沟通 936487697
GMT+8, 2025-6-19 20:30 , Processed in 0.102701 second(s), 8 queries , Redis On.
Powered by Discuz! X3.4
Copyright © 2001-2023, Tencent Cloud.