By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,193 Members | 826 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,193 IT Pros & Developers. It's quick & easy.

Declaration Syntax Error

DanielTNBaker
P: 7
Basically gettting a "Declaration Syntax Error" do not understand what i have done wrong would appreciate it if someone could help.

void Search_Client(void);
void PriceList(void);
void Exit(void);
client_struct fetchrec(); <-- getting error here
void writerec (FILE * client_file, struct client_struct client);

thanks for help =]
Feb 26 '07 #1
Share this Question
Share on Google+
5 Replies


DeMan
100+
P: 1,806
a syntax error menas that something you have written can't be understood by the compiler...is a client_struct defined when you state it is a return value?
Feb 26 '07 #2

DanielTNBaker
P: 7
sorry if i sound stupid kinda new to C but trying to make an array of records program.

i defined client_struct as:

struct client_struct
{
int blah,
blah;
}

and in the main function it is used like

void Add_Client(void)
{
struct client_struct client_rec;
FILE * client_file;
client_file = fopen(CLIENTS, "a");

client_rec = fetchrec();
etc
}

client_struct fetchrec()
{
struct client_struct client;
int array;
clrscr();
etc
}

this make sense?

thankyou
Feb 26 '07 #3

Expert 100+
P: 1,510
you missed struct out a few times, try
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. struct client_struct
  3. {
  4. int blah;
  5. blah;
  6. };
  7.  
  8. and in the main function it is used like
  9.  
  10. struct client_struct fetchrec()
  11. {
  12. struct client_struct client;
  13. int array;
  14. etc
  15. }
  16.  
  17. void Add_Client(void)
  18. {
  19. struct client_struct client_rec;
  20. client_rec = fetchrec();
  21. etc
  22. }
  23.  
Feb 26 '07 #4

DanielTNBaker
P: 7
#include <stdio.h>
void Add_Client(void);
void Edit_Client(void);
void Display_Client(void);
void Search_Client(void);
void PriceList(void);
void Exit(void);
struct client_struct fetchrec(); <-- added struct here got rid of error there
void writerec (FILE * client_file, struct client_struct client);

struct client_struct fetchrec() <-- when i added the struct here it gave me e lot more errors =/ any clues?
{
struct client_struct client;
int array;
etc
}

void Add_Client(void)
{
struct client_struct client_rec;
client_rec = fetchrec();
etc
}
Feb 26 '07 #5

Expert 100+
P: 1,510
this now compiles - you need to complete the functions and add a main()
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2.  
  3. struct client_struct
  4. {
  5. int blah;
  6. //blah;
  7. };
  8.  
  9. void Add_Client(void);
  10. void Edit_Client(void);
  11. void Display_Client(void);
  12. void Search_Client(void);
  13. void PriceList(void);
  14. void Exit(void);
  15. struct client_struct fetchrec(); //<-- added struct here got rid of error there
  16. void writerec (FILE * client_file, 
  17. struct client_struct client);
  18.  
  19. struct client_struct fetchrec() //<-- when i added the struct here it gave me e lot more errors =/ any clues?
  20. {
  21. struct client_struct client;
  22. int array;
  23. //etc
  24. }
  25.  
  26. void Add_Client(void)
  27. {
  28. struct client_struct client_rec;
  29. client_rec = fetchrec();
  30. //etc
  31. }
  32.  
Feb 26 '07 #6

Post your reply

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