anonymous
  • anonymous
Can anyone help me with my C program? [error: expected ‘)’ before ‘*’ token]
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
I declared my structures using typedef: typedef struct { char OrigCurr[4]; char WantCurr[4]; float ExRate; } STRUCTTYPE_Rates; typedef struct { char User[31]; char Pass[31]; char Role[14]; } STRUCTTYPE_Users; STRUCTTYPE_Rates STRUCT_Rates[100]; STRUCTTYPE_Users STRUCT_Users[100]; I'm trying to pass the parameter by pointer: int TXTDATA_Read_Rates(STRUCTTYPE_Rates* STRUCT_Rates, FILE *STREAM_Rates) { //blahblah } int TXTDATA_Read_Users(STRUCTTYPE_Users* STRUCT_Users, FILE *STREAM_Users) { //blahblah } Now when I compile, i get the following error message, for both lines above: error: expected ‘)’ before ‘*’ token What am I doing wrong?
arnavguddu
  • arnavguddu
typedef struct { char User[31]; char Pass[31]; char Role[14]; } STRUCTTYPE_Users; modify to typedef struct _STRUCTYPE_Users { char User[31]; char Pass[31]; char Role[14]; } STRUCTTYPE_Users; now it should work...and also modify other struct declaration too
anonymous
  • anonymous
How come changing 'struct' to 'struct _STRUCTTYPE_Users' will solve the problem?

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

arnavguddu
  • arnavguddu
struct must have a name defined.....but no name is provided....
arnavguddu
  • arnavguddu
try it and tell me if the error still persist or vanishes
anonymous
  • anonymous
Error still persists.
arnavguddu
  • arnavguddu
o i got it...mhy fault.. STRUCTTYPE_Rates STRUCT_Rates[100]; // ok STRUCTTYPE_Users STRUCT_Users[100]; // ok int TXTDATA_Read_Rates(STRUCTTYPE_Rates* STRUCT_Rates, FILE *STREAM_Rates) // change the argument variable names....they are already declared global variables...cannot reuse the names{ //blahblah } int TXTDATA_Read_Users(STRUCTTYPE_Users* STRUCT_Users, FILE *STREAM_Users) // same here { //blahblah } change it
arnavguddu
  • arnavguddu
then tell me
anonymous
  • anonymous
Error still persists. I changed it to : int TXTDATA_Read_Rates(DATATYPE_Rates a, FILE *b, int *c) {
anonymous
  • anonymous
BTW I changed STRUCTTYPE to DATATYPE.
arnavguddu
  • arnavguddu
attach the whole code....let me run and c wat happens
anonymous
  • anonymous
Hold on. Let's do it one at a time. My lesser problem is the pass integer by reference one, so I'm uploading my .c file where I declared the structures as global. In this way all we have to debug first is the passing integer by reference issue.
1 Attachment
anonymous
  • anonymous
After fixing this one, I'm going to put the structures inside the main function and put the necessary parameters so that we can debug that problem next.
anonymous
  • anonymous
Umm I forgot to delete the expletives in my code (lol). Just ignore it; I was using them to test if the functions were getting called correctly.
arnavguddu
  • arnavguddu
i just get the following warnings::: C:\Users\Arnav\Desktop\New folder>vcvarsall Setting environment for using Microsoft Visual Studio 2010 x86 tools. C:\Users\Arnav\Desktop\New folder>cl test.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. test.c test.c(93) : warning C4047: '=' : 'int *' differs in levels of indirection from 'int' test.c(95) : warning C4047: 'return' : 'int' differs in levels of indirection fr om 'int *' test.c(116) : warning C4047: '=' : 'int *' differs in levels of indirection from 'int' test.c(118) : warning C4047: 'return' : 'int' differs in levels of indirection f rom 'int *' c:\users\arnav\desktop\new folder\test.c(52) : warning C4700: uninitialized loca l variable 'STREAM_Rates' used c:\users\arnav\desktop\new folder\test.c(53) : warning C4700: uninitialized loca l variable 'STREAM_Users' used Microsoft (R) Incremental Linker Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. /out:test.exe test.obj C:\Users\Arnav\Desktop\New folder>
anonymous
  • anonymous
I get these: file.c: In function ‘TXTDATA_Read_Rates’: file.c:93: warning: assignment makes pointer from integer without a cast file.c:95: warning: return makes integer from pointer without a cast file.c: In function ‘TXTDATA_Read_Users’: file.c:116: warning: assignment makes pointer from integer without a cast file.c:118: warning: return makes integer from pointer without a cast
arnavguddu
  • arnavguddu
ok... got rid of all the warnings and errors... check it
1 Attachment
anonymous
  • anonymous
Thanks, that works now. May I ask why you put 2 asterisks in FILE **STREAM_Rates?
anonymous
  • anonymous
Also I'm uploading the .c file again. This time we're debugging for the struct errors. Notice that I changed the parameters in function int TXTDATA_Read_Rates and it still gave me these errors: test.c:74: error: expected ‘)’ before ‘a’ test.c:99: error: expected ‘)’ before ‘STRUCT_Users’ test.c:153: error: expected ‘)’ before ‘STRUCT_Users’ test.c:175: error: expected ‘)’ before ‘STRUCT_Users’ test.c:210: error: expected ‘)’ before ‘STRUCT_Users’
1 Attachment

Looking for something else?

Not the answer you are looking for? Search for more explanations.