Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4569986
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:17:50+00:00 2026-05-21T19:17:50+00:00

i checked and didnt find any material which can help me so i had

  • 0

i checked and didnt find any material which can help me so i had to ask. this is the code:

list.h:

typedef struct List_t *List;

list.c:

#include "list.h"
#include <stdlib.h>
#include <stdio.h>


typedef struct Item_t
{
    struct Item_t* next;
    ListElement data;
}*Item;

typedef struct List_t
{
    Item head;
    Item iterator;
    CopyListElement copyFunc;
    FreeListElement freeFunc;
};

list_example_test.c:

#include "list.h"
#include <stdlib.h>
#include <stdio.h>
ListElement copyA(ListElement a)
{
    return a;
}
void destroyA(ListElement a)
{
}
bool testListCreate();
bool testListCopy()
{
    List list1=listCreate(copyA,destroyA);
    listInsertFirst(list1,(void*)6);
    listInsertFirst(list1,(void*)2);
    listInsertFirst(list1,(void*)1);
    List list2=listCopy(list1);
    listClear(list1);
    if(list2->head==NULL) //here is the error!!
    {
        return false;
    }
    return true;
}

the last piece of code is supposed to check whether the listCopy() function works. the compiler recognizes the name List and when i type “list2->” it even suggests to autocomplete with the fields of List(in this instance i chose “list2->head”.
what is causing the problem and how to fix it? thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T19:17:51+00:00Added an answer on May 21, 2026 at 7:17 pm

    List_t is an incomplete type as far as list_example_test.c is concerned. This is actually a common idiom in C for encapsulating data. There should be functions defined somewhere to allow you to manipulate items of type List_t without directly accessing the internals of the list. You’ll probably find you have something like listNext(List_t) or listIterate(List_t) defined somewhere. Look in the same file as where listCopy() is declared.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I checked this website and I didn't find any solution. I was made a
I'm having this problem and I didnt find any answers on the web. I
I can't find any information about event checkins. Facebook do this in their application
I checked the documentation, but can't seem to find what I'm looking for. I
possibly it is silly to ask such questions, but really couldn't find any answers
The closest answer I could find to my question here was this (which has
this may sound silly, but i can´t find anywhere how to specify the pivotXType
This is silly, but i can't understand how to do it. Checked out from
I have checked the assembler options of GNU assembler as and I didn't find
I checked this link of S.O : Pop Images like Google Images And tried

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.