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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:45:03+00:00 2026-05-31T00:45:03+00:00

I have a basic problem. I should know enough about pointers by now. The

  • 0

I have a basic problem. I should know enough about pointers by now. The way I see it configData is the first link in a linked list (of the type struct config) while procNames is a pointer to the first link in a linked list of the type struct config. So if I want to say that procNames is equal to configData then I need to access the pointer that points to configData which is *configData. Anyhow I think I am missing something. Anyone sees the problem? Also, I get the next error: error: invalid type argument of unary ‘*’ (have ‘struct config’)

struct config_line {
    char name[MAX_WORD];
    int time;
};

struct config {
    struct config_line *lines;
    int count;
};

//global variable
struct config configData;
//local variable
struct config *procNames;
//the problem (done locally) 
procNames = *configData;
  • 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-31T00:45:04+00:00Added an answer on May 31, 2026 at 12:45 am

    I think you want

    procNames = &configData;
    

    This sets the pointer procNames to the address of the structure configData.

    You can access the elements using either

    procNames->count
    procNames->lines[i].name  // Pointer to the 1st char of the name in the i'th config_line structure
    

    or

    configData.count
    configData.lines[i].name
    

    Remember that, since lines is itself a pointer, you’ll need to allocate memory for each config_line structure:

    struct config_line thisLine;   // Declare a structure
    procNames->lines = &thisLine;  // Point to it
    

    or

    // Declare a pointer to an array of structures, allocate memory for the structures
    struct config_line *linePtr = malloc(NUM_STRUCTS * sizeof(struct config_line));
    procName->lines[i] = *linePtr; // Points to 1st structure in the array
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have such a basic problem in Delphi,I can't solve it. My Code: Note:DataR
So I have a rather basic javascript problem which I have been slamming my
I have a very basic texture map problem in GL on iPhone, and I'm
The problem is quite basic. I have a JTable showing cached data from a
I think I have a synchronization problem...It may be too basic..Please help.. I have
I have a basic problem with a has_one and belongs_to association. I have two
I have the following problem: Suppose I have some basic counter class Counter .
I have an interesting problem. I'm using visual basic and before saving a row
Okay So I know this is super basic and I should know how to
first, you should know that i suck big time at SQL. Here is my

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.