Explore BrainMass
Share

Explore BrainMass

    C Add Function to add Two List Structures

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    I am working on program assignment in structures (c language)after entering the required integers the add function will not compile.I receive error messages I am using a Microsoft c, c++ 6.0 compiler. The help required is to provide a working add function in c. Hopefully after that I will be be able to write similar functions to subtract multiply and divide.

    © BrainMass Inc. brainmass.com October 9, 2019, 3:43 pm ad1c9bdddf
    https://brainmass.com/computer-science/c/c-add-function-to-add-two-list-structures-11186

    Attachments

    Solution Preview

    The solution is attached.
    <br>
    <br>The given problem requires that an add function be provided that should add two given lists n and m. Please verify that the following steps are done in order to achieve the desired result.
    <br>
    <br>1. getinput1() is used to create the linked list of the first series of integers n.
    <br>2. getinput2() is used to create the linked list of the second series of integers m.
    <br>3. for each node (i.e each integer) of the first linked list n, create a new node of another list t, such that ...

    Solution Summary

    The given problem requires that an add function be provided that should add two given lists n and m. The add function traverses the lists in order to add the contents. This is an excellent way of learning about the operation of C structures, in particular the application of Linked Lists in C. You can use the same concept to subtract, multiply or divide numbers, in effect build a calculator.

    $2.19