accessing an array of structures
i am having trouble figuring out how to access the other elements of an array of structures that is returned by a function called sg_get_network_iface_stats .
As is noted below, the function returns a pointer to the first element in an array.. which i can access fine. How do i access the other elements though, as i dont seem to have a handle on the actual array, only a pointer to the first element within it...
.. I think trying to learn C is making me more dumbererrr, as the solution is probably simple :-(
sg_network_iface_stats *sg_get_network_iface_stats( entries);
int * entries;
The sg_get_network_iface_stats function takes a pointer to an int, entries, which is filled with the number of network interfaces the machine has. This is needed to know how many sg_network_iface_stats structures have been returned. A pointer is returned to the first sg_network_iface_stats.