Hey everyone,

I've been staring at my code for over an hour and I can't seem to figure out what's wrong. I was hoping someone could help me before I lose my mind completely:

I would like to have an array that holds pointers to structs.

I'd like to create these structs and shove them in this array and later be able to search the array to find a certain struct based on its name.

This is what my code looks like:

my struct looks like this:

Code:
typedef struct {
   char *entryName;
   [other vars here]
}regEntry;    


// global array of struct pointers...
regEntry *entryTable[100];
int numEntries=0;

int rpcRegisterFunction(char *name, [other params]) {
    regEntry *newRegEntry = malloc(sizeof(*newRegEntry));
    
    newRegEntry->entryName = name;
    [fill the rest of struct vars here]    

        // put my struct pointer into the array of pointers
        entryTable[numEntries] = newRegEntry;
    numEntries++;
}



int rpcServer(void){
   // receive a message (struct), call it recMsg
   // recMsg will contain a name
   regEntry *foundRegEntry;
   foundRegEntry = (regEntry *)getRegEntry(recMsg->rpcName);   
   return;
}

//Search method - will search array by name and return pointer to the struct having the requested name
regEntry * getRegEntry (char *name)    {
   int iter;
   
   for (iter=0; iter<numEntries; iter++)    {
      if (strcmp(entryTable[iter]->entryName, name) == 0)   { 
           return entryTable[iter];
      }
   }    
}
I'm not sure if it's my C (which I don't really know that well) or if it's my logic... I'm not entirely sure that the malloc thing is doing what I want either.

When I try to compile I get this:

rpc_server.c:138: error: conflicting types for 'getRegEntry'
rpc_server.c:118: error: previous implicit declaration of 'getRegEntry' was here


line 138 is my function declaration
regEntry * getRegEntry (char *name) {

and line 118 is my assignment when I come back from the search:
foundRegEntry = (regEntry *)getRegEntry(recMsg->rpcName);

Please, please please help if you can. Like I said, if I don't resolve this soon, I'm gonna start throwing things!!!

Thanks in advance,

Tanya