Click to See Complete Forum and Search --> : Passing pointers to structures to functions in C


Concrete Geist
10-26-2001, 08:47 PM
int put_stat( char *s, int stat, int *list, struct *renter );

This prototype tells me there is a parse error on its line. I don't know what's wrong.

jkm
10-26-2001, 09:19 PM
shouldn't you be passing

int foo(struct structname *nameinscopeoffunction)

?

unless you typedef'd your struct of course.

Strogian
10-27-2001, 09:34 AM
Well, I'm assuming that the struct type that you're trying to pass is a 'struct renter', since you probably don't have a 'struct struct'. :) So, here's what I think it should look like:
int put_stat(char *s, int stat, int *list, struct renter *somename);

(to define a variable of some struct type, you must use 'struct <structname> <varname>', unless you typedef it)