Create a linked-list pointers


Discussion:

Q: Given the code what is the values of the following expressions.

They may be undefined or the boolean expression may be invalid

a) firstptr->next->firstname

b) firstptr->next-next->SSN

c) firstptr->next==lastptr

d) currptr->next->lastname

e) currptr->next->lastname

f) firstptr==lastptr->next

g)firstptr->SSNnext->SSN.struct personaldata

{
string firstname;
string lastname;
int ssn;
personal data* next;
}

personaldata* currptr;
personaldata* firstptr;
personaldata* lastptr;
}

currptr = null;
firstptr = null;
lastptr = null;

currptr = new personaldata;
currptr->firstname = "sally";
currptr->lastname = "simon";
currptr->ssn = 12346789;
currptr->next = new personaldata;
lastptr=currptr->next;
lastptr->firstname = "george";
lastptr->lastname = "gunther";
lastptr->ssn = 127608712;
firsptr = new persondata;
lastptr->next = firstptr;
firstptr->firstname = "mary";
firstptr->lastname = "mae";
firstptr->ssn = 23855555;
firstptr->next = currptr;

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Create a linked-list pointers
Reference No:- TGS01937540

Now Priced at $25 (50% Discount)

Recommended (98%)

Rated (4.3/5)