Answer the question
In order to leave comments, you need to log in
How to access a struct inside a function?
Data packets containing longitude and latitude arrive at the port. The number of packets becomes known only after the arrival of the head packet (which comes first). The data needs to be written to the structure, where there are two arrays of longitude/latitude, but how to declare the size of the array in the structure, if it is unknown before the arrival of the head packet? If you put a struct in a function that accepts the size of arrays, how do you access that struct?
Answer the question
In order to leave comments, you need to log in
If it's C++, then you need to use containers, like std::vector. Storing latitude and longitude in two parallel arrays is wrong from a design point of view. It is necessary to create a structure (class) Point, with two fields lat, lon. You need to store a list of these points. You can put this list in your structure as well.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question