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 7613687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:12:53+00:00 2026-05-31T02:12:53+00:00

I have read about 5 different questions on the same error, but I still

  • 0

I have read about 5 different questions on the same error, but I still can’t find what’s the problem with my code.

main.c

int main(int argc, char** argv) {
    //graph_t * g = graph_create(128); //I commented this line out to make sure graph_create was not causing this.
    graph_t * g;
    g->cap; //This line gives that error.
    return 1;
}

.c

struct graph {
    int cap;
    int size;
};

.h

typedef struct graph graph_t;

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-31T02:12:55+00:00Added an answer on May 31, 2026 at 2:12 am

    You can’t do that since the struct is defined in a different source file. The whole point of the typedef is to hide the data from you. There are probably functions such as graph_cap and graph_size that you can call that will return the data for you.

    If this is your code, you should define struct graph inside the header file so all files that that include this header will be able to have the definition of it.

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

Sidebar

Related Questions

I have read about storing session state out-of-process but still in memory by configuring
Most code I have ever read uses a int for standard error handling (return
I have read about different types of virtualization in Wikipedia but my question is:
I have read about the different types of reference. I understand how strong, soft
Recently I have read a lot about different NoSQL databases and how they are
I have read about application object in android site but I couldn't understand. What
I have read a number of questions on this site about this issue, I
I have two questions about C's fread function: I have read that fread is
I've read a lot of different questions on SO about multithreaded applications and how
I often read that lazy is not the same as non-strict but I find

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.