作者darrenliuptt (Darren)
看板C_and_CPP
標題[問題] 像這樣 結構中的結構指標 是什麼意思?
時間Tue Dec 8 23:13:37 2015
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VS2012
C++
問題(Question):
#include <stdio.h>
#include <stdlib.h>
int main ()
{
struct circle
{
int x, y;
int radius;
struct circle *next;
};
....
其中的自己結構中的結構變數指標next
不太懂像這樣next是包含哪些變數呢?
為何要這樣宣告?有什麼意義嗎??
謝謝指教!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.231.121.220
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1449587620.A.384.html
→ Caesar08: 就像linked list一樣 12/08 23:46
推 LPH66: 不是就像, 它就是 linked list 12/08 23:47
哦哦,好的!那我從這方面研究一下!
謝謝!
※ 編輯: darrenliuptt (36.231.121.220), 12/08/2015 23:48:10
→ chchwy: 目的就是把好幾個circle串成一串 12/09 00:30
推 lkk45266: 因為這個指標變數是要指向下一個結構體(自己) 12/09 22:22
→ MOONRAKER: 指向自己除了零長度以外有什麼用 是指向「同類」好嗎 12/10 02:28