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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:51:50+00:00 2026-06-05T21:51:50+00:00

I am reading some book and I have encountered a piece of code that

  • 0

I am reading some book and I have encountered a piece of code that wasn’t explained in the book, but has some part which is very confusing to me, bold part, and I want to know what is it about.

void Set::intersection(const Set& s1, const Set& s2)
{
    Set s;
    s.arrayA = new double[ s1.sizeA<s2.sizeA ? s1.sizeA : s2.sizeA];
    int i, j, k;
    while(i < s1.sizeA && j < s2.sizeA)
        if(s1.arrayA[i] < s2.arrayA[j])
            i++;
        else if (s1.arrayA[i] > s2.arrayA[j])
            j++;
        else
            s.arrayA[k++] = s1.arrayA[j++,i++]; // question is about this line

    s.sizeA= k;
    deleteA();
    copyA(s);  
}

What does it do, and why is there two parameters inside the [] brackets? Thanks in advance.

  • 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-05T21:51:52+00:00Added an answer on June 5, 2026 at 9:51 pm

    Two parameter within brackets is expression using comma operator. Result of such expression is result of last item (j++, i++ gives i incremented by one, while j is also incremented by one).
    So s.arrayA[i++] = s1.arrayA[j++,i++]; really can be converted to equal j++, s.arrayA[i++] = s1.arrayA[i++];

    This code intersects to sets s1 and s2. It seems code suggests that arrays (that implement sets) are sorted.
    Code is walking on s1.arrayA and s2.arrayA and if some element is present in both sets, than it places that element in s.arrayA.

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

Sidebar

Related Questions

I've been reading the Swing Hacks book and have used some of their code
I have a strange issue from a client in that our code, which they
I am going through this book and have hit some examples that I am
Firstly I know I have some reading to do with this but I was
I have some question about arrays, I'm reading some book about Java, and now
I have been reading a book about network programming but I am confused about
I am reading Real World Haskell (great book) and I have some confusion about
Reading the Jon Skeet book, I have found (some time now) the use of
I am reading a book on OpenGL, SDL, and have read some of the
I'm reading an Objective-C book and I have a question that the book doesn't

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.