1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Rep Power

    Pointer and Struct Exploration

    Write a program that declares two variables of type double and two pointers of type double.

    Do these steps:

    First initialize the first pointer to point to the first double variable. Use the dereferencing operator to initialize the variable to 21.20.

    Next initialize the second double variable to [last 3 digit in your matriks number.eg;2120123 your variable is 1.23]. Point the first pointer to this variable.

    Now make the second pointer point to a different location in memory (unnamed) and make its pointer value to be 10.

    Change the second pointer so that it now points to yet another different location in memory (unnamed) and make its pointer value by twice the pointer value of the other pointer.

    Add a line of code to print the product of the two pointers that remain.

    Before each step, give a comment that takes up a whole line that tells what step you're doing, e.g. "//STEP 1."

    After each step,
    Make a drawing on paper of memory. Show all variables and pointers (and links to pointers) that have been declared.

    Print out the values of all variables that have been initialized. Print out all pointers that have been initialized. Label each of these outputs with what step they go with.

    Leave a line of whitespace before the next step.

    I need an urgent help .. :(

  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Rep Power
    Yeah, you're going to have to put in more effort than that.

    We ignore people who just copy/paste their assignment and adding "urgent" is just good for a laugh.

    This isn't a homework factory where you can show up with a list of demands and we bust our asses to deliver finished homework ASAP for the princely sum of $0.

    If you've been genuinely paying attention in class and doing your previous assignments, then you should be able to manage the first couple of steps on this assignment. Post what you CAN achieve and then we'll be glad to help.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper

IMN logo majestic logo threadwatch logo seochat tools logo