1. ## Theoritical question.

I haven't still understood good after reading a lot the point of self-reference in a struct. Does it replace the addition of a new node in the struct? If yes, does it replace the "add new node in the end"?

2. Are you talking about a node in a linked list? If so, the pointer to a node that is a member of the node struct is not a "self-reference"; it is a pointer to the next node in the linked list.

3. A structure cannot contain another structure which is identical to itself. This is a logical impossibility. It can contain a pointer to another structure identical to itself. This is often useful. For example, if you have a linked list, you have a "next" pointer member, whch points to the next item in the list. At list end, it is null. If you have a binary tree, you could hace "leftchild" and "rightchild" pointers, maybe a "parent" pointer. And you can build up other structures of arbitary complexity.

C has a quirk, which is that normally people typedef structures and make the structure itself nameless.

eg you will often see code like
Code:
```typedef struct
{
char name[32];
double salary;
int payrollid;
} EMPLOYEE;```
If you need self-references, the typedef "EMPLOYEE" is not available at the point where the structure members are defined.
So if we want a linked list of employees

Code:
```typedef struct linked_employee
{
char name[32];
double salary;
int payrollid;
struct linked_employee *next; /* must use the struct tag here */
However we can use the name "LINKED_EMPLOYEE" everywhere else, including whist accessing the "next" member.
The use of the tag is purely a little workaround for one of C's quirks.

4. I'm refering to the self-reference part. Don't understand it much and good.

5. Originally Posted by TheGreekMan2000
I'm refering to the self-reference part. Don't understand it much and good.
What do you mean by the "self-reference part"? A code snippet might help.

6. What's a pint and a quirk?

7. What's a sippet?

8. Post code. Actually, let's make this a rule: whenever you ask a question that has to do with some code concept, post relevant code to go along with it.

9. Nice. The question remains the same as in the first post above. The code is that:

Code:
```typedef struct
{
int year;
int month;
int day;
}date;
typedef struct
{
double latitude;
double longitude;
}location;
typedef struct incList
{
/*Gia string ""*/
char area[100];
date reported;
int total_missing;
char cause_of_death[150];
char location_description[500];
location coordinates;
char URL[100];
struct incList *next;
}incident;```
I ask because I want to add in the last struct 10 incidents with ZERO changes in the structs and with the following form:

\$> newIncident Mediterranean;;5;2;0;1;Drowning,Asphyxiation;Off the coast of Larache, Morocco;35.189860435378,-6.173145606543; https://archive.ph/gB4Vs

With semicolons( in between each member of the struct incident.

10. From what I see, you want to parse that line of input separated by semi-colons into the nodes of a linked list.

If you find this difficult to understand, then take a step back and imagine you had this struct instead:
Code:
```typedef struct incList
{
int value;
struct incList *next;
} incident;```
Imagine also that you have 10 incidents with the following form:
1;2;3;4;5;6;7;8;9;10

Write a program to parse this line of incident numbers to create a linked list of 10 incident objects using the struct I showed you.

Resist the urge to work on your actual program until you have done this. The idea is to acquire the skill of working with a simple linked list where each node has just one int data member before you try handling a linked list that's more complex, like the one in your actual program.

11. The semicolons doesn't refere to the repetitions of the program but rather for the separation of the data that must be put into the incident struct.

12. Originally Posted by TheGreekMan2000
The semicolons doesn't refere to the repetitions of the program but rather for the separation of the data that must be put into the incident struct.
Normally data fields are separated by commas, and records are separated by newlines. Here, a semicolon rather than a newline is the record separator. That's only a small difficulty. Start by splitting your input on semicolons, to get the records.

13. What's a data field? Also, where you refere to "records" you mean something like a voice messege or music?

14. Originally Posted by TheGreekMan2000
What's a data field? Also, where you refere to "records" you mean something like a voice messege or music?
Imagine a payroll program. An employee has a name, a salary, and a payroll id. These are the three "fields". Taken together, they describe an employee, and are a "record".

15. Ahhhh.