首页 > 解决方案 > 如何访问另一个结构内的链表的元素?

问题描述

我想计算 DriverProfile 链表中存在的元素数量。我想通过结构 ParkingLot 访问链表来做到这一点。

//Declaring the linked list
struct DriverProfile{
    char name[20];
    int license_plate;
    struct DriverProfile *next_profile;
};
// Declaring the structure for parking lot containing the DriverProfile list identified by the *profiles pointer which is the pointer to the first element of the DriverProfile linked list

struct ParkingLot{
    struct DriverProfile *profiles ;
    int lotSize;
};

标签: clistpointersstructlinked-list

解决方案


推荐阅读