473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Reading from pointer to a struct

drhowarddrfine
7,435 Expert 4TB
I'm playing around with data passed in a structure. In one function I do this:
Expand|Select|Wrap|Line Numbers
  1. /* path is defined as char* path[10] in the struct */
  2. struct request customer_request; 
  3. if(strcmp("order",customer_request->path[0])==0) order(customer_request);
In the called 'order' routine, I do this:
Expand|Select|Wrap|Line Numbers
  1. void order(struct request *customer_request){
  2.  
  3. 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
Dec 8 '07 #1
2 1277
oler1s
671 Expert 512MB
Yes, precisely. customer_request is not a pointer. Yet, you have order taking a pointer as a parameter.
Dec 9 '07 #2
drhowarddrfine
7,435 Expert 4TB
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.
Dec 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Harbinger of Doom | last post by:
Hello, I'm currently working on a program that has to read values from the windows registry. I use the functions "RegOpenKeyEx", "RegCloseKey" and "RegQueryValueEx" for that. If I can read the...
27
by: Alan | last post by:
// C Pointer int y = 0; int* ptr = &y; Reads as "ptr is an integer pointer that points to (takes the address of) integer y". // C++ Reference int x = 0; int& ref = x;
10
by: Kieran Simkin | last post by:
Hi, I wonder if anyone can help me, I've been headscratching for a few hours over this. Basically, I've defined a struct called cache_object: struct cache_object { char hostname; char ipaddr;...
4
by: JS | last post by:
I have a file called test.c. There I create a pointer to a pcb struct: struct pcb {   void *(*start_routine) (void *);   void *arg;   jmp_buf state;   int    stack; }; ...
4
by: Henk | last post by:
Hi, I am new to the c-programming language and at the moment I am struggling with the following: I want to read a file using fread() and then put it in to memory. I want to use a (singel)...
1
by: Alex | last post by:
I have a simple enough struct.. public struct InstallationGeneral_Lock { public int Case_name; public int Run_year; public int Inst_name; public int Inst_loc; public int State; public int...
5
by: Johs32 | last post by:
I have a struct "my_struct" and a function that as argument takes a pointer to this struct: struct my_struct{ struct my_struct *new; }; void my_func(struct my_struct *new); I have read...
12
by: gcary | last post by:
I am having trouble figuring out how to declare a pointer to an array of structures and initializing the pointer with a value. I've looked at older posts in this group, and tried a solution that...
16
by: Jm.GlezdeRueda | last post by:
Hi all, Im trying to read a 24bit bmp with fread, and i have some problems.. I want to read the whole structure in one time, but i dont know why, it only reads the first member well.. I have...
4
by: Laharl | last post by:
My Operating Systems professor has assigned homework that basically boils down to implementing ls -lra, but with a different output format. In other words, list the files and subdirectories (and a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.