I was noticing that if you use sizeof to get the size of a char array that is not from to the function you are calling it from, it doesn't work. Even if you have a function that takes in a string, like function(char *string); and you refer to it as "string" instead of it's actual declaration name it still doesn't. Am I doing something wrong, and if not, anyone know why this is so?
Code:
void ash(char *string);
main() {
char str[50];
//sizeof would work fine here
return 0;
}
void ash(char *string) {
printf("%d", sizeof(string)); <--why doesn't this work?
printf("%d", sizeof(str)); // <--I understand why this doesn't work, can't access a local var outside it's function
} //
btw, the freeware version of my program is done! as soon as i get a webpage to store it on, i'll post it here for all to d/l, cause i certainly couldn't have done it w/o everyone's help