Linear data structures in Table 1

 

hello Hello, everyone, today is the first blogging after sprouting new ancestral occupancy blog. New Meng Meng ancestral want to record their own experiences new growth by way of blogging. My problem is also a great problem may be encountered are sprouting new, I'll put my own understanding and issue to you, I hope to help sprout new, welcome criticism and correct me, thank you!

Table 1. Linear sequential storage structure

(Define what are the linear form in the book, I do not introduced)

Sequential storage structure of the linear form: a set of consecutive addresses of the storage unit sequentially stores the data elements in the linear form.

It can be known by definition, the array just to meet contiguous storage unit sequentially stores this requirement.

Next to hard goods ( definition of the structure of the sequential storage structure )

#define MaxSize 100 
typedef struct  
{ 
    int Data [MaxSize];     // define a total length of an array MaxSize 

    int the Length;            // current length of the data storage (Table 5 that is the order of elements, the Length =. 5) 
} Sqlist ;

I do not know how many new eruption did not understand this, anyway, I did not see (the premise completion c language, was feeling himself learned a fake C)

This problem is most obvious in the preparation of cross-examination of students who (in fact, I was quasi-cross-candidates), so we do not worry ah, can not read normal, it will slowly up.

#define MaxSize 100   This code surely you can understand, it means instead of using MaxSize number 100 (it appears in this program MaxSize refers to 100)
that such a benefit is to write what? Not that the next time you want to define an array of length 999 when you do not need to put a 100 into a 999 thing of

typedef struct 
{
    int data[MaxSize];
    int Length;
}Sqlist;

Learned C students know and structures typedef struct, so that you can understand for me to take the individual structure type named Sqlist (Note that this is not a statement of structure variables)
That Sqlist equivalent to the structure type , here comes you may still not quite understand. See the following example:
 
 Assume a structure

 struct   Dir              
{ 
    int num;
    char ch; 
};

How to declare that structure variable it?

struct Str S1, S2;     // structure variable declarations

Use typedef to simplify:

typedef struct Str 
{ 
    int Data [the MaxSize];
     int the Length; 
} Sqlist; 
Sqlist S1, S2;     // declare variables, so we have not found Sqlist equivalent
                       // struct Str (structure type), is not a very easy

That structure is defined questions point sequential storage structure is now finished
(a word here I quote a small turtle, "let's look at the image point No PIC A J8 say! "):

So when you see this when you should realize that, in fact, in the description of the structure of the array of those fancy front, you can understand the sequence table is an array.
We just use arrays and structures to his current length integrated into it together;

for the first time blogging I feel pretty good, hey. Continue tomorrow, the order of the table insert, delete, search operations;

 

 

 

 

Guess you like

Origin www.cnblogs.com/zulkar/p/10960672.html