1. ## Question on structs

Can someone explain what this small piece of code means.

Code:
```struct Record {
int ID;
int EntryTime;
Position next;
};```
Is "Position" a newly created type? Thanks in advance.

2. >Can someone explain what this small piece of code means.
Record is a structure that contains three members: two integers and a user defined type.

>Is "Position" a newly created type?
It's hard to tell without more code, the most possible thing is that Position is another structure. But it could simply be a typedef for an existing type.

-Prelude

3. Thanks Prelude!

Another question

Code:
```struct Record {
typedef struct Record *r;
typedef struct Record *Position;```
Is this a typedef for an existing struct as you posted earlier. I'm very confused!

4. I might be wrong, but I'm pretty sure you can't typedef in the middle of a struct.

If you're looking for a struct that contains a pointer to itself (a classic linked list scenario):

Code:
```struct Record
{
int ID;
int EntryTime;
struct Record *next;
};```
It can be typedef'd and used like this:
Code:
```#include <stdio.h>

typedef struct Record
{
int i;
int EntryTime;
struct Record *next;
} Record_t;

int main(void)
{
Record_t MyRecord;

MyRecord.i = 10;

printf ("MyRecord.i = %d", MyRecord.i);

return (0);
}```
By typedef'ing the struct, you can reference it through Record_t, instead of "struct Record".

5. Code:
```struct Record {
typedef struct Record *r;
typedef struct Record *Position;```
"Oh yuck" was my first reaction to reading that. Yes, both r and Position are alternate names for struct Record * by using typedef. But, since typedef isn't allowed as a storage class for struct members this won't work too well.

>I'm very confused!
It helps to think of typedef as a storage class, like static, and the new type name that is being created like a regular variable. For example, to declare a static integer named x you would say:

static int x;

But to create a new name x for int, you do the same thing except with typedef:

typedef int x;

In the first declaration, x is a variable of int and can be used to hold values. In the second declaration x is declared to be another name for int, so you can create variables of x and use them just like variables of int:

x i;
for ( i = 0; i < 10; x++ ) printf ( "%d\n", x );

The great thing about typedef is you can create names like this:
Code:
```#include <stdio.h>

typedef void (*FindRec) ( void );

static void print ( void )
{
(void)puts ( "We're here through a function pointer" );
}

static FindRec func ( void )
{
return &print;
}

int main ( void )
{
FindRec p = func();
p();
return 0;
}```
It's all very fun when you get the hang of it.

-Prelude

6. Thank you Hammer and Prelude. I was looking at some sample code on the internet and could not figure out the logic of the program. I guess I should be weary of my sources. Thanks again for your help!

7. that was nice prelude