菜鳥圖解簡單連結串列(轉)

post0發表於2007-08-11
菜鳥圖解簡單連結串列(轉)[@more@]

程式碼:

#include

{

long num;

float score;

struct student *next;

};

int main()

{

struct student a, b, c, *next, *p;

a.num = 99101; a.score = 89.5;

b.num = 99103; b.score = 90;

c.num = 99107; c.score = 85;

head = &a;

a.next = &b;

b.next = &c;

c.next = NULL;

p = head;

do

{

printf("%ld %5.1f ", p ->num, p ->score);

p = p -> next;

}

while ( p != NULL);

}

[myimg]upload/005_205.png[/myimg]

[myimg]upload/004_170.png[/myimg]

[myimg]upload/003_195.png[/myimg]

[myimg]upload/002_207.png[/myimg]

[myimg]upload/001_208.png[/myimg]


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8225414/viewspace-944744/,如需轉載,請註明出處,否則將追究法律責任。

相關文章