data from a device and then use this data in various other codes like for alert system, uploading to cloud etc. I am thinking if I create a global struct in a header file and write data to its instance and then use this global variable in other codes. But I am confused how to do it correctly.
Can someone please suggest me what should I do??
You can create a singleton. But it's considered a bad practice. https://refactoring.guru/design-patterns/singleton Or you can pass pointer of the object that contains relevant information to other classes so they can read from it.
Обсуждают сегодня