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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:06:35+00:00 2026-05-18T08:06:35+00:00

I want to show that first two citizen are married together in 2009 using

  • 0

I want to show that first two citizen are married together in 2009 using pointers (let’s say citiens are Anthony Hopkins and Jodie Foster)

struct citizen
{
char sSSC[12];
char sFamilyName[16];
char sNames[24];
char cGender; //men ='m', women='w'
citizen*pSpouse; //Null if not married
int iYearOfMarriage;

}
citizen People[100000];
  • 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-18T08:06:36+00:00Added an answer on May 18, 2026 at 8:06 am

    You mean, just:

    People[ANTHONY_HOPKINS].pSpouse = &People[JODIE_FOSTER];
    People[JODIE_FOSTER].pSpouse = &People[ANTHONY_HOPKINS];
    People[ANTHONY_HOPKINS].iYearOfMarriage = 
    People[JODIE_FOSTER].iYearOfMarriage = 2009;
    

    Or am I misunderstanding the question? ‘.’ is used to reference members in a struct (or -> if you have a pointer to a struct), ‘&’ is a pointer to that symbol.

    You’ll probably also want to declare that as:

    struct citizen *pSpouse;
    

    Leaving the ‘struct’ as implicit is supported in C++ but not in C (though if you have a pure-C++ compiler then you can mostly use it for C code, with the odd thing like that not reported as an error when it should be).

    Addition:

    To test whether records 0 and 1 are married:

    if(People[0].pSpouse == &People[1])
    {
        printf("They're married!\n");
    }
    

    Comparing the value of pointers is always a valid way to check whether they point to the same thing.

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

Sidebar

Related Questions

I have 2 pages that I want to show as instructions the first time
I want to show data that returned from controller, in onComplete function: function onComplete()
I want to show a div that serves as a loading screen when invoking
I want to show the image that mobile phone's camera its taking on a
I want to show a dialog that will allow the user to select a
I want to consume a webservice and show that answer in tabhost on android.How
I want to show a child div (That is within a parent container) above
I want to show all PDF filenames that has 33 in any position. sample
I want to create an Android application that show the sales report from SQL
I want the mobile-client device to show information that are on the .jsp file.

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.