samedi 25 avril 2015

How could I call a function as a pointer from an array in c++?


So Im using an array of structs like so:

struct node
{
  char* name;
  int   value;
};

node *nodeArray = new node*[50];

Im trying to call a function from the array so I can search through the elements like so:

struct node* newNode;
newNode = nodeArray->find(name);

if name was a char* so it returns a pointer to the node in the array once the name is found.

How would I go about creating a class to call a find function from the array?


Aucun commentaire:

Enregistrer un commentaire