|
Home > Archive > Unix Programming > December 2007 > Accessing data with pointer to structure
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Accessing data with pointer to structure
|
|
| drhowarddrfine 2007-12-09, 1:36 am |
| I'm playing around with data passed in a structure. In one function I
do this:
/* path is defined as char* path[10] in the struct */
struct request customer_request;
if(strcmp("order",customer_request->path[0])==0)
order(customer_request);
In the called 'order' routine, I do this:
void order(struct request *customer_request){
if(strcmp("menu",customer_request->path[1])==0)
menu(customer_request);
but I get a compiler error:
warning: passing arg 1 of `menu' from incompatible pointer type so I
don't understand what the problem is, obviously.
| |
| fjblurt@yahoo.com 2007-12-09, 1:36 am |
| On Dec 8, 7:51 pm, drhowarddrfine <robbel...@gmail.com> wrote:
> I'm playing around with data passed in a structure. In one function I
> do this:
>
> /* path is defined as char* path[10] in the struct */
> struct request customer_request;
> if(strcmp("order",customer_request->path[0])==0)
> order(customer_request);
>
> In the called 'order' routine, I do this:
>
> void order(struct request *customer_request){
> if(strcmp("menu",customer_request->path[1])==0)
> menu(customer_request);
>
> but I get a compiler error:
> warning: passing arg 1 of `menu' from incompatible pointer type so I
> don't understand what the problem is, obviously.
The `menu' function is expecting a pointer to something of a different
type than `struct request'. Look at its definition and figure out
what it should be passed.
I like your handle, by the way.
| |
| drhowarddrfine 2007-12-09, 1:36 am |
| On Dec 8, 10:20 pm, fjbl...@yahoo.com wrote:
> On Dec 8, 7:51 pm, drhowarddrfine <robbel...@gmail.com> wrote:
>
>
>
>
>
>
>
>
> The `menu' function is expecting a pointer to something of a different
> type than `struct request'. Look at its definition and figure out
> what it should be passed.
>
> I like your handle, by the way.
Ack! Yes. Stupid of me. I was looking at the "menu" string and not
the menu function. Thanks.
And glad you like the handle. nyuck nyuck.
|
|
|
|
|