Hi,
I need to create a function that will allow me to search for records in a struct.
Any ideas if how to get started?
Thanks

Recommended Answers

All 3 Replies

Do you mean search records in a array of a struct?
It can be quite tough for us to help without knowing what your struct look like.
Post the code of your struct or anything what you have tried.
Searching a struct involves searching value of a key member of the struct array.

Create an array/vector of the struct (or pointers to), iterate it, compare the member variables to what you are looking for.

search for records in a struct.

well you have vaguely mentioned the problem.please tell the various data members in structure , the one whos content is unique (like roll no , employee id etc ) for all objects of struct could be easy to use as the search element .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.