0
Can I use the whole array?
Is it possible to use in code the whole array without specifying which of its members should it be but to use them all without using for loop?
6 Respuestas
+ 2
Can you describe what exactly you want to achieve?
+ 2
If it's a raw (C-style) array, you can pass the array, but it will be only a pointer, so you have to pass the size as well so that your function knows the limit.
If it's the array template you're using, you can pass it as a reference and use it normally in the function.
+ 1
as far you know the length of the array, you can write to it directly
0
But what if its written only by user?
0
You mean without specifying the data type? Sure: use void*. But you'll loose typesafety at compile time.
0
no. I mean it to use it as a function parameter or things like that.