#include<stdio.h>
void printS(char []);
int main(){
char str[]="The C Programming Language";
printf("%d \n",sizeof(str)); //output=27
printS(str);
}
void printS(char s[]){
printf("%d \n",sizeof(s)); //output=4
}
为什么这个anamolous输出为什么sizeof()一个char数组有时sizeof(void *)有时sizeof(数组)?
请解释什么是“海峡”和“S” .... 以及如何我可以有之间的差异的sizeof()输出=在打印功能27。
在介绍类中,我们经常被教导数组是指针,指针是数组。这不是真的。它们在许多方面类似,但不相同。 – abelenky