Are you saying to use a different variable type?
Or are you saying to type cast it?
If its the first, I want to get the length of a pointer thats being passed.
Edit: Forgot to say, thanks for the help. Normally I'd use a vector like that, except in this case I'm being passed an in pointer.
I'm pretty sure it's impossible to get the length of an array from the address of the base pointer. You the programmer are responsible for keeping track of the length. That's why when you pass an array to a function, you generally pass the length as well. Regarding "length of a pointer", I assume you are referring to "number of elements in the array"? Regardless, I know of no way to get the 8 from x in your original example. Store 8 in a separate variable.
Reputation Points: 2614
Solved Threads: 687
Posting Expert
Offline 5,372 posts
since Jan 2008