Possible Duplicate:
How to find the sizeof(a pointer pointing to an array)
Sizeof an array in the C programming language?
#include<stdio.h>
void doit(char x[10]){
printf("%d\n", sizeof(x));
}
void main(void){
char x[10];
printf("%d\n", sizeof(x));
doit(x);
}
** I don't know why my question is removed first time. ** Two outputs here are different. Apparently the first one knows x is an array and second one only knows it a ptr. My question is why compiler knows that in the first case it's an array instead of a ptr?