Computer Science Homework Solutions
Problem
#131339

C++ linked list pointers

given the attached 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

Attached file(s):
Attachments
point.txt  View File

Attachment Content Summary (Note: view attachment at the above link before purchasing. Actual attachment content may vary slightly from that shown below.)

point.txt
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 Summary

Linked list of pointers is explored.

Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$11.97)
Included in Download
  • Plain text response
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • DHTML - (See attached file for full problem description) I want to be able to enter my name and press return which the jpg picture will load. Then I want to be able to click the link which will move the p ...
  • Linked Lists C++ - What is the output of the following C++ statements? See attached file for full problem description.
  • pointerlists - Whenever the pointer of a list or a tree is manipulated, the procedure that performs this operation must be considered to be in a critical section. Please explain why the above statement is true and w ...
  • Create BNF grammars for boolean expressions of the specified form. - a. Create a BNF grammar that describes simple Boolean expressions of the form var AND var var OR var where var is one of the symbols w, x, y, and z. b. Modify your grammar from part (a) so t ...
  • Given a C function show how to derive variable values if expressions are evaluation from left to right or from right to left. - Let the function fun be defined as int fun(int *k) { *k += 4; return 3 * (*k) - 1; } Suppose fun is used in a program as follows void main() { int I = 10, j = 10, sum1, sum2; sum1 = (I / ...
Browse