数组名到底代表什么啊
int number = {......省略};number == &number
说明数组名是该数组首元素的地址
那sizeof(number)不应该是8bytes吗
可是打印出来的是40bytes整个数组的大小
想知道number到底是代表数组首元素的地址,还是整个数组 数组第 0 个元素的地址
对于 sizeof 来说
sizeof(number) != sizeof(&number)
人造人 发表于 2021-10-4 21:01
对于 sizeof 来说
sizeof(number) != sizeof(&number)
感谢解答{:5_105:} 70000 发表于 2021-10-5 18:41
感谢解答
https://blog.csdn.net/letian3658/article/details/106065205?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163289882116780271551823%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=163289882116780271551823&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-3-106065205.pc_search_ecpm_flag&utm_term=%E6%95%B0%E7%BB%84%E5%90%8D%E3%80%81%E6%95%B0%E7%BB%84%E9%A6%96%E5%85%83%E7%B4%A0%E5%9C%B0%E5%9D%80&spm=1018.2226.3001.4187
https://blog.csdn.net/oyt1999/article/details/103887840?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163289882116780255227644%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=163289882116780255227644&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_ecpm_v1~rank_v31_ecpm-4-103887840.pc_search_ecpm_flag&utm_term=%E6%95%B0%E7%BB%84%E5%90%8D%E3%80%81%E6%95%B0%E7%BB%84%E9%A6%96%E5%85%83%E7%B4%A0%E5%9C%B0%E5%9D%80&spm=1018.2226.3001.4187 人造人 发表于 2021-10-4 20:59
数组第 0 个元素的地址
想再问一下
#include<stdio.h>
#include<string.h>
int main(void)
{
char num = "gmbh|ZPV`GJOE`JU`IBIB~";
for (int i = 0; i < strlen(num); ++i)
--num;
printf("%s\n", num);
return 0;
num在printf和strlen()里面也是跟sizeof()一样的吗 70000 发表于 2021-10-5 18:56
想再问一下
#include
#include
数组名是 数组第 0 个元素的地址,除了用于 sizeof
str == &str
除了用于 sizeof
#include <stdio.h>
#include <string.h>
int main(void) {
char str = "abcd1234";
{
size_t size = strlen(str);
printf("%s\n", str);
}
{
size_t size = strlen(&str);
printf("%s\n", &str);
}
return 0;
}
人造人 发表于 2021-10-5 19:06
除了用于 sizeof
非常感谢解答{:5_105:} bszs 发表于 2021-10-5 18:45
https://blog.csdn.net/letian3658/article/details/106065205?ops_request_misc=%257B%2522request%255F ...
非常感谢解答{:5_105:}
页:
[1]