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

  • SEARCH
  • Home
  • 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 8007779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:56:16+00:00 2026-06-04T17:56:16+00:00

I’m pretty new in C and having some problems with all the pointer stuff.

  • 0

I’m pretty new in C and having some problems with all the pointer stuff.

I wrote this code:

typedef struct edgeitem
{
    double          weight;
}EDGE_ITEM, *pEDGE_ITEM; //also declaration of a pointer

/************ edge that includes a pointer to the edge item, next and prev ******/
typedef struct edge
{
    pEDGE_ITEM  *edge_item;  
    pEDGE       *next;      //pointer to next edge
    pEDGE       *prev;      //pointer to prev edge
}EDGE, *pEDGE;

I get an error this way and just cant understand why.

I know that edgeitem and edge are tags and I can use struct edge *next but I declared the pointers so how come i can’t use them?

Do i need to use * if I have a pointer?

pEDGE_ITEM *edge_item
//or
pEDGE_ITEM edge_item

I cant understand, it’s a pointer so why do I add the *?

And the last question is:
If I’m using the above, what’s the difference between:

*EDGE  next
EDGE  *next

and last one :
if I’m adding:

typedef struct edge_list
{
    EDGE        *head;
}EDGE_LIST;

is it the same as :

pEDGE      head;
  • 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-06-04T17:56:17+00:00Added an answer on June 4, 2026 at 5:56 pm

    You cannot use pEDGE within the definition of the struct. You shoud do something like:

    typedef struct edge {
        pEDGE_ITEM          *edge_item;  
        struct edge         *next;      //pointer to next edge
        struct edge         *prev;      //pointer to prev edge
    } EDGE, *pEDGE;
    

    You must also note that edge_item is a double pointer. You also mention that in your question. So if you use pEDGE_ITEM and you just want to have a normal pointer you should not write pEDGE_ITEM *edge_item but just pEDGE_ITEM edge_item.

    For clarifying, all the following declarations are equivalent:

    struct edgeitem *edge_item;
    EDGE_ITEM *edge_item;
    pEDGE_ITEM edge_item;
    

    But

    pEDGE_ITEM *edge_item;
    

    is equivalent to

    struct edgeitem **edge_item;
    EDGE_ITEM **edge_item;
    

    About *EDGE next that is wrong syntax. The correct syntax would be EDGE* next or pEDGE next. So once struct edge is defined you can just use any of these two, but while defining the struct, you must do as I show at the beginning of my answer.

    Yes, the following two definitions are equivalent:

    typedef struct edge_list {
        EDGE        *head;
    } EDGE_LIST;
    
    typedef struct edge_list {
        pEDGE        head;
    } EDGE_LIST;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have some data like this: 1 2 3 4 5 9 2 6
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.