Header File Understanding Help

This is a discussion on Header File Understanding Help within the C Programming forums, part of the General Programming Boards category; Alright I've got this header file, and I want to double check to make sure I understand this. I'm in ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    53

    Header File Understanding Help

    Alright I've got this header file, and I want to double check to make sure I understand this. I'm in the middle of a huge human resource prgoram and I feel if I understand this structure header file completely I'll be able to create a copy of all data entered into a text file. Ok here is the code:

    Code:
    #ifndef EMPLOYEE_DATA_H
    #define EMPLOYEE_DATA_H
    //structure declaration
    struct personal
    {
           char firstname[25];
           char lastname[25];
           char SSN[12]
    };
    typedef struct personal PERSONAL;
    
    struct employee
    {
          char salary[9];
    };
    typedef struct employee EMPLOYEE;
    
    struct EmpData
    {
         EMPLOYEE emp_data;
         PERSONAL pers_data;
    };
    typedef struct EmpData EMPDATA;
    
    //function declaration
    EMPDATA* enter_data(int* num_array);
    EMPDATA get_data();
    #endif
    Now I've got two structures personal and employee for the separate data. I'm creating a human resource program. Next I have another structure named EmpData that I rename to EMPDATA. Now is this correct? Inside struct EmpData I have two more strucutures defined as EMPLOYEE emp_data; and
    PERSONAL pers_data; I have not worked on this program in quite some time so I'm making sure I understand that those are two structures within a structure that way it has all its members so I can manipulate it and add data to it. Lastly I have two functions enter_data and get_data so i can ask the user to enter data and then get that data that was entered to store in the structures I have in this header file. Let me know if I have understoof this correctly?

    Thanks!

  2. #2
    Registered User penney's Avatar
    Join Date
    Jan 2003
    Posts
    47
    Looks good. You will then have to create a .c file that includes the header and then define a variable as one of those types... EMPDATA person; Which could be defined as an array or a pointer to some memory that you are going to allocate or in my case here a single person.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 05:27 PM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 04:25 PM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 10:54 AM
  4. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 09:19 PM
  5. Replies: 6
    Last Post: 04-02-2002, 05:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21