Here's an example of working linked list. Basic functions such as add to list, clear list and print list elements are provided. Hope this helps you to understand better.
[CODE]

include <iostream>

using namespace std;

struct input
{
int id; // current id
input *next; // pointer to next input
} ;

class input_events
{
private:
input head; // pointer to head
input
curr; // pointer to current

public:
    input_events();             // constructor
    void ClearLinkedList();     // clear list
    void add_ie(input *p);      // add input
    void print_ie();            // print all in list

};

// constructor
input_events::input_events()
{
head = NULL; // head points to NULL
curr = NULL; // current points to NULL
}

// add input
void input_events::add_ie(input *p)
{
if(head == NULL) // first in list
{
head = p; // head
curr = head; // current points to head
}
else
{
curr->next = p; // add to list
curr = p; // update current pointer
}
}

// clear list
void input_events::ClearLinkedList()
{
input ptr = head; // points to head
input
qtr = head->next; // points to second

// loop through list and delete all
while (ptr != NULL)
{
    delete ptr;
    ptr = qtr;

    if(ptr != NULL)
    {
        qtr = ptr->next;
    }
    else
    {
        qtr = NULL;
    }
}

head = NULL;    // reassign head to NULL
curr = NULL;    // reassign current to NULL

}

// print all in list
void input_events::print_ie()
{
input *ptr = head;

cout << "*********************" << endl;
cout << "Input ...

Here are some codes which you may use to record the time.
[CODE]

include <time.h>

time_t start, end;
double duration = 0;

time(&start);
// your codes here
time(&end);
duration = difftime(end, start); // time in milliseconds
[/CODE]

Whenever possible, try to avoid nested loop as they have a worst-case of O(n2) - Big O n square. In simple terms, it has bad processing time because your worst case for nested loop is n square iterations. When your n is sufficiently large, your logic will take a very long time to run.

Since you are reading from the stdin, you should use the function gets(char *str) which reads from the stdin and does not include the new line character (\n) in buffer

jephthah commented: make me come out of retirement just to downvote your sorry ass -2
jose jimenez commented: gets?? dude, are you serious??? +0
Aia commented: What's next? fflush(stdin)? Forget that gets() exists. -2

First of all, your file should be written in binary which contains nothing but the objects of your c structure.

Here's a breakdown of what you should do:

  1. Open the file in binary format and read to the end of the file. Make sure the size is correct (correct size should be a multiple of your c structure's size)
  2. If the structure is correct, allocate memory to the pointer using malloc()
  3. use fread() to read the whole chunk to the pointer

You're now ready to access your c structure from the pointer.

Yes, as demonstrated by Aia, you do not need to deal with incrementing pointers yet. You may pass in the address of a particular CITIZEN object
[CODE]display_cit(&cit[x]);[/CODE]
Then create a pointer as parameter to be able to access the passed in object's value
[CODE]void display_cit (CITIZEN *individual)[/CODE]