0

circular data strcture

how can i make circular data structure using pointer. . .

26th Oct 2016, 4:47 AM
අචින්ත උදේෂික
අචින්ත උදේෂික - avatar
1 Odpowiedź
+ 1
Do you mean a ring-like structure? You can use a linked list. struct smthing { /* int x; const char *id; etc */ smthing *next; } ; now you manage the individual elements of the linked list. Have the last element point to head: llist->next = &head; Be aware that you have to manage your memory manually with new and free.
26th Oct 2016, 9:12 AM
Ullrich Franke
Ullrich Franke - avatar