Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing/returning pointers to structures

Status
Not open for further replies.

msc0tt

IS-IT--Management
Jun 25, 2002
281
CA
Argh!!!!
I can't compile some linked-list code, and I'm sure it's due to my inexperience with pointers. The errors are:
clrusers.c(105): Warning! W102: Type mismatch (warning)
clrusers.c(105): Note! N2003: source conversion type is 'int '
clrusers.c(105): Note! N2004: target conversion type is 'struct _t_connList *'

My code snippit is:

typedef struct _t_connList {
WORD connection;
char username[MAX_DN_CHARS];
int isException;
struct _t_connList *next;
} t_connList;

int main(void)
{
t_connList *connList = NULL;
connList = getConnections(connList); // line 105 error!
return 0;
}

t_connList *getConnections(t_connList *connList)
{
// do stuff
return (connList);
}

-with thanks
 
typedef struct _t_connList {
WORD connection;
char username[MAX_DN_CHARS];
int isException;
struct _t_connList *next;
} t_connList;

// add prototype or reverse order of functions
t_connList *getConnections(t_connList *connList);

int main(void)
{
t_connList *connList = NULL;
connList = getConnections(connList); // line 105 error!
return 0;
}

t_connList *getConnections(t_connList *connList)
{
// do stuff
return (connList);
}
 
Prototypes!!!! How could I forget this - sheesh!!
thanks, cdlvj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top