Thread: Help with C Program Hw Parameters

  1. #1
    Registered User
    Join Date
    Feb 2011

    Question Help with C Program Hw Parameters

    Hi i need help with my hw: heres the question

    2. Function with Input/Output Parameters

    Write a void function called Result that has only two type int input/output parameters. The function will return the sum of the two original parameters through the first parameter. It will also return the differences of the two original parameters through the second parameter.

    Write a main function to test this function.

    This is what i have , ive also include the exe of the program and a sample pic

    #include <math.h>
    #include <stdlib.h>
    #include <stdio.h>
    void result(double *smp, double *lgp);
              double num1, num2;
               /* Gets test data */
               printf("Enter the first number");
               scanf("%lf", &num1);
               printf("Enter the second number");
               scanf("%lf", &num2);
               printf("The first number is %2.f", num1);
               printf("The second number is %2.f", num2);
               return (0);
    result(double *num2, double *num1)
                 double temp;
                 if (*num1 < *num2){
                           temp = *num2;
                           *num2 = *num1;
                           *num1 = temp;
                 num1 = num1 + num2;
                 num2 = num1 - num2;
    return (0);

  2. #2
    Programming King Mr.777's Avatar
    Join Date
    Mar 2011
    Middle of NoWhere
    Awesome :-)
    What a great program....
    Anyways, was just kidding....
    1. You implemented the function but didn't use.
    2. Inside main you should use that function call.
    I'll recommend you to read this....

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Your program doesn't produce that output.

    It doesn't contain anything to print "After the function is called..." and it doesn't contain any call to the function you have written.
    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.

  4. #4
    Join Date
    Aug 2010
    Ontario Canada
    So, what was the plan... Maybe post up some garbage lines to get past the homework rule and then wait for us to fix it for you?

    Please ... do the work and try again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to execute other program within c program?
    By KoYoungSuk in forum C Programming
    Replies: 7
    Last Post: 06-07-2010, 05:08 AM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  3. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  4. process parameters
    By gvector1 in forum C# Programming
    Replies: 3
    Last Post: 06-05-2003, 11:40 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

Tags for this Thread