Results 1 to 3 of 3
Can anyone please explain what's wrong with the following:
In header file control.h I have prototype:-
/* Toggle relay */
int toggle_relay(relays *);
In source file tsc_ctrl.c I have:-
typedef ...
- 03-20-2009 #1Just Joined!
- Join Date
- Jan 2009
- Location
- On the bay, Morecambe Bay.
- Posts
- 15
pointer to struct argument
Can anyone please explain what's wrong with the following:
In header file control.h I have prototype:-
/* Toggle relay */
int toggle_relay(relays *);
In source file tsc_ctrl.c I have:-
typedef struct {
int addr; /* Base Address for I/O */
int offset; /* Base offset */
int num; /* Relay number */
int state; /* ON/OFF */
int type; /* Valve; Switch; . . .*/
char label[20]; /* Device name e.g. LP_PUMP */
} relays;
relays relay[20];
When I compile this program I get the error message:-
In file included from tsc_ctrl.c:23:
control.h:34: error: parse error before '*' token
What is wrong with the prototype?
How do I pass a pointer to the type 'relays' to a function??
- 03-21-2009 #2Linux User
- Join Date
- Jan 2006
- Posts
- 414
looks like you're trying to use the type relays before declaring it.
- 03-22-2009 #3Just Joined!
- Join Date
- Jan 2009
- Location
- On the bay, Morecambe Bay.
- Posts
- 15


Reply With Quote
