I've got a problem with the following program:
In main() I have defined a structure array, and a pointer to this structure array. I believe that the way it is definied is that the pointer points to the first array in the structure.
There are several functions called in main (), and I work with the structure array so I pass the functions the pointer to the structure array. Some of these functions call other functions and I have no trouble with passing the pointer on to these other functions.
This all works fine because I am basically scanning lines of an input file and storing specific details of each line in the strucure arrays, (one array for each line of input). After I scan a line, I increment the pointer to the structure array and it automatically points to the next array, which is great.
However, what happens when I need to alter, for instance, the 5th array in the structure within a function? I have passed the function the pointer to the structure array, and this points to structure array. I have no idea how to access specific arrays within other functions.
If the structure pointer the function works with is "struct_ptr", then to get array I could just use struct_ptr++ and then access it with struct_ptr->member1, but is there any other way to do it? I know struct_ptr->member1 and struct_ptr->member1 are useless, but I had to try something!! Is there a method I am missing, or an alternative solution?
Thanks in advance,