Structures

  • Uploaded by: Patrick Johnston
  • 0
  • 0
  • July 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Structures as PDF for free.

More details

  • Words: 147
  • Pages: 3
Structures Pentru a permite ca mai multe tipuri de structuri să se refere unele la altele, putem declara un nume ca fiind numele unui tip de structură: Structuri înlănţuite #include #include<string> #include //#include using namespace std; struct List; struct Link { struct Link* pred; struct Link* succ; struct List* member_of; }; struct List { struct Link* head; }; void main() { struct List list1; //definim o lista care nu e pointer la List! struct Link *pc, *p; //definim doi pointeri de tip Link pc = new struct Link; //primul nod p = pc; list1.head = p; p->pred = list1.head; p->member_of = &list1; pc = new struct Link; //al doilea nod pc->member_of = &list1; p->succ = pc; pc->pred = p; p = pc; } Vezi desenul de pe pagina următoare

struct List list1

struct Link *head

struct Link* *pred

*succ

List* member_of

struct Link* *pred

*succ

List* member_of

Related Documents

Structures
July 2020 33
C Structures
November 2019 9
Discrete Structures
November 2019 15
Market Structures
June 2020 9
Data Structures
October 2019 38

More Documents from "sandra456"