|
[求助]关于数组于指针
[QUOTE=wsjswy;1419003]arr的类型和p的类型不同。编译器认为arr的类型是int [4][4], 而p是int *[/QUOTE] 既然arr于p类型不同,为何却可以写成p=a[0]? |
|
[求助]关于数组于指针
[QUOTE=yeyeshun;1418981]正规写法: int a[4][4]; int (*p)[4]; p=a; 猥琐的写法是强制类型转换: int a[4][4]; int *p; p=(int*)a; 这种写法的话,你需要自己去计算索引数组元素[/QUOTE] 谢谢夜夜顺,只是不明白为什么同样都是地址,p为啥不能等于a呢?为什么还需要转换? |
|
[求助]关于数组于指针
谢谢,不过问题不是下标是几,只是不明白:a是个地址,为什么不能直接传给p呢? |
|
[求助]main外面和里面定义的区别
[QUOTE=IamHuskar;1417082]影响其实有很多。这个和编译器以及优化方式有关。你换编译器编译。可能第二个又出错了。 你的 你的name若在里面 char name[] char output[8]; name和output是连在一起的一块内存 假设栈name地址比output高那么往output里面写。溢出就覆盖了...[/QUOTE] 感谢! 这下明白了! |
|
[求助]main外面和里面定义的区别
这例子好像不太恰当。。。。但各位应该能明白我意思吧 |
|
[求助]main外面和里面定义的区别
仔细想想,也不对 位置不同的是name这个参数,而output的位置没变(都是在main里面定义的); 而这里是使用name来覆盖output的,也就是说,name的位置变不变跟output没关系啊?为什么两次返回的结果不同呢? 举个例子,name相当于女朋友,main外面定义的name相当于北京的女朋友,main里面定义的name相当于上海的女朋友,但是我(相当于output)一直是我,没变过(一直都是在main里面定义的),为什么上海的女朋友来我家就愿意跟我打啵,北京的女朋友来我家就不愿意呢?(外面的name覆盖output会报错,里面的name覆盖output就不会报错) |
|
|
|
[求助]main外面和里面定义的区别
什么问题? |
|
[求助]main外面和里面定义的区别
其实目的就是要他越界,但是为什么第二个不出错呢?搞不懂 |
|
[求助]《0day安全:软件漏洞分析技术》需要的前置知识
不知道对汇编知识的要求高不高 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值