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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:17:42+00:00 2026-06-17T13:17:42+00:00

gcc 4.7.2 c89 Hello, I am trying to dereference a pointer to a pointer

  • 0
gcc 4.7.2
c89

Hello,

I am trying to dereference a pointer to a pointer to a structure, and I get this error message when I do the following:

LOG_INFO("CHANNEL ID --- %d", *channel->id);

Compile error

request for member ‘id’ in something not a structure or union

If I try and cast it to the correct pointer type, I still get the same error message:

LOG_INFO("CHANNEL ID --- %d", (*(channel_t*)channel->id));

I solved the problem by declaring a new variable and assigning the address of where the structure is pointing to:

channel_t *ch = NULL;
ch = *channel;
LOG_INFO("CHANNEL ID --- %d", ch->id);

I am just wondering why the first two methods failed.

Many thanks for any suggestions,

structure:

typedef struct tag_channel channel_t;
struct tag_channel {
    size_t id;
    char *name;
};

The way I am calling it:

channel_t *channel = NULL;
channel = (channel_t*)apr_pcalloc(mem_pool, sizeof *channel);
LOG_CHECK(job_queue_pop(queue, &channel) == TRUE, "Failed to pop from the queue");

And the function, I am having trouble with:

apr_status_t job_queue_pop(apr_queue_t *queue, channel_t **channel)
{
    apr_status_t rv = 0;
    channel_t *ch = NULL;

    rv = apr_queue_pop(queue, (void**)channel);
    if(rv != APR_SUCCESS) {
        char err_buf[BUFFER_SIZE];
        LOG_ERR("Failed to pop from the queue %s", apr_strerror(rv, err_buf, BUFFER_SIZE));

        return FALSE;
    }

    ch = *channel;  
    LOG_INFO("CHANNEL ID --- %d", ch->id);
    LOG_INFO("CHANNEL NAME - %s", ch->name);

    return TRUE;
}
  • 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-17T13:17:44+00:00Added an answer on June 17, 2026 at 1:17 pm

    You have the operator precedence wrong. -> operator has a higher precedence than . operator. So -> is evaluated before . making it *(channel->id) which is wrong.

    Look at the following code. It works fine.

    typedef struct test_
    {
       int i;
    }test;
    
    int main()
    {
       test a;
       test *aptr = &a;
       test **aptrptr = &aptr;
       a.i=6;
       printf("\n%d\n",(*aptrptr)->i);
       return 0;
    }
    

    Read about precedence here.

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

Sidebar

Related Questions

gcc (GCC) 4.7.0 c89 Hello, I have the following structure that I am trying
gcc 4.7.2 c89 Hello, I am getting the following warning: pointer/integer type mismatch in
gcc 4.7.2 c89 Hello, I have this function that assigns a pointer to an
gcc 4.7.2 c89 GNU Make 3.82 I am trying compile this program I have
gcc (GCC) 4.6.3 c89 Hello, I am just wondering if this is the best
gcc 4.7.2 c89 Hello, I am using posix message queues: mq_create, mq_send, mq_receive, etc.
gcc 4.7.2 c89 Hello, The function GetCallRef(...) expect a pointer to a buffer for
gcc (GCC) 4.7.0 c89 Hello, I have trying to save a database of rows
gcc 4.7.2 c89 Hello, I have the following function: void module_param_destroy(module_param_t *param) { param
gcc 4.6.2 c89 I am passing a pointer to a function. This pointer will

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.