Reading from pointer to a struct

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    Reading from pointer to a struct

    I'm playing around with data passed in a structure. In one function I do this:
    Code:
    /* 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:
    Code:
    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
  • oler1s
    Recognized Expert Contributor
    • Aug 2007
    • 671

    #2
    Yes, precisely. customer_reques t is not a pointer. Yet, you have order taking a pointer as a parameter.

    Comment

    • drhowarddrfine
      Recognized Expert Expert
      • Sep 2006
      • 7434

      #3
      Ack! I misread the error and was looking at strcmp("menu".. .. as the problem rather than the function menu(). Thanks.

      The real problem is I re-wrote menu() which takes different arguments.

      Comment

      Working...