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];
You mean, just:
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:
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:
Comparing the value of pointers is always a valid way to check whether they point to the same thing.