I've got an array which was built by a function called getdir().
This reads in the content of a directory (one filename at a time),
puts each element into the array, then it sorts the array
alphabetically via qsort().
Does anybody know how to get the real size of this array if
it was declared as:
char **arr; (this is a global var).
I tried sizeof(arr) but it says the size is 4, which is
true only if the array has 1 element. Therefore I can't
get the number of elements with "sizeof(arr) / sizeof(arr[x])",
as this will also be 1 in every case.
I know that the array could be declared as
char *arr[a bigger number];
However, this is not good either, because this method
will allocate space for a much bigger array than what I need.
My teacher told me that this is a limitation of C, and it
could be solved only by implementing a "special programming
technique". Unfortunately he wasn't very specific about
So, what do you think, is this true? If yes, could anyone tell
how to solve this?
Any suggestions would appreciated. I'm completely
Please help me out guys!
Thanks in Advance.