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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:19:26+00:00 2026-06-08T21:19:26+00:00

This is from a past paper at university. There’s a struct initialised: struct double

  • 0

This is from a past paper at university.

There’s a struct initialised:

struct double {int value; struct * double pred; struct * double succ;};

Then in the main function:

main(...)
{
    struct double * d1, * d2, * d3;
    d1 = newDouble(33);
    d2 = newDouble(55);
    d3 = newDouble(77);
    d1 -> succ = d2;
    d2 -> pred = d1;
    d2 -> succ = d3;
    d3 -> pred = d2;

    printf("%d/n", d1->succ->succ->pred->value); // ??
}

What I don’t understand is what the -> does in printf. I can’t work out what the value would actually be.

  • 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-08T21:19:26+00:00Added an answer on June 8, 2026 at 9:19 pm

    -> is dereferencing the pointers to access fields: d1->succ is shorthand for (*d1).succ.

    With this convoluted construction: d1->succ->succ->pred->value, you’ll end up with the value of d2, presumably 55:

    • d1->succ is d2.
    • So d1->succ->succ is equivalent to d2->succ, which is d3.
    • So d1->succ->succ->pred is equivalent to d3->pred, which is d2.
    • So d1->succ->succ->pred->value is equivalent to d2->value.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having difficulty interpreting this formula that was from a past exam paper that
This question is for revision purposes from a past exam paper I just want
This question is from a past exam paper and it is used for revision
Am trying to sortout this small issue from past hour : <script type=text/javascript> $(document).ready(function(){
I am trying to do this task from the past 12 hour, but still
This (from body of a stored proc) is throwing a syntax error: IF (name
I've been trying this from a long time. I'm having today's date and I
I got this from Load web browser with web response . and am wondering
I'm cross-posting this from the wordpress section, b/c I think the problem lies more
Say I write this: from subprocessing import Popen, STDOUT, PIPE p = Popen([myproc], stderr=STDOUT,

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.