having problems with structure.

Thread Solved

Join Date: Nov 2007
Posts: 7
Reputation: controlsi is an unknown quantity at this point 
Solved Threads: 0
controlsi controlsi is offline Offline
Newbie Poster

having problems with structure.

 
1
  #1
Dec 3rd, 2007
Hello,
well this portion of code is basically just the structures from the program. everytime i compile the program i get an error at the INFOstructure.
i am using these structure in a program that read from a file and prints the data to the screen. my problem is that for some reason my structures are wrong.
thanks in advance for helping,
David

  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. #define STR_SIZE 25
  5. #define ARR_SIZE 10
  6. #define MAX 15
  7.  
  8. typedef struct
  9. {
  10. char month [MAX];
  11. int day;
  12. int year;
  13. }DATE;
  14.  
  15. typedef struct //this is the structure that is giving me problems. for some reason the
  16. { // its keeps saying no semicolon or union after struct.
  17. char firstname[MAX];
  18. char lastname[MAX];
  19. DATE birthday;
  20. SSN social[9];
  21. GRADE stugrade;
  22. }INFO;
  23.  
  24. typedef struct
  25. {
  26. char social;
  27. }SSN;
  28.  
  29. typedef struct
  30. {
  31. int grade;
  32. }GRADE;
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,401
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1467
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: having problems with structure.

 
0
  #2
Dec 3rd, 2007
The problem is that SSN and GRADE have not been declared yet. To fix move lines 24 thru 32 up to just under line 13.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 7
Reputation: controlsi is an unknown quantity at this point 
Solved Threads: 0
controlsi controlsi is offline Offline
Newbie Poster

Re: having problems with structure.

 
0
  #3
Dec 3rd, 2007
thanks haha.
i was just reading the section in my book and its told me exactly what you said.
that the structure have to be initialized in a certain order
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC