Pointers, structs, and functions, oh my!

This is a discussion on Pointers, structs, and functions, oh my! within the C++ Programming forums, part of the General Programming Boards category; Hey, here's a real quick question:
How do I pass an array of structs as a pointer to a void ...

You and codegirl are both actually declaring the parameter of the function as an array of FOO pointers. Your question does not require that the parameter to the function be an array of pointers, but rather you require a single pointer to an array of FOO structures, so you can use either of the following methods to declare your function:

void I_eat_foo_too(FOO my_array[]);

or

void I_eat_foo_too(FOO* parray);

and you would call the function like this for both declarations:

FOO foo[5];

I_eat_foo_too(foo);

That is a fairly obvious way to call the function for the first declaration, but it also works for the second declaration since an array name is actually a pointer.

In addition, you will not use the -> operator to access the data members of the elements of the array since the elements of the array aren't pointers, rather the elements of the array are FOO structs, so you need to use the . operator to access the data members:

"I'm also kind of unclear on why you dont use -> to acess member variables"

Its simple: you use the -> operator on pointers to objects, and the . operator on objects. So, you have to ask yourself whether the elements of your array are objects or pointers to objects. How you pass the array to the function is irrelevant.