Help with multi function progam

This is a discussion on Help with multi function progam within the C Programming forums, part of the General Programming Boards category; So now that I do unstand, even though I did change it, what else can I do to have it ...

  1. #16
    Registered User
    Join Date
    Oct 2004
    Posts
    56
    So now that I do unstand, even though I did change it, what else can I do to have it run?

    Thank You

  2. #17
    Ultraviolence Connoisseur
    Join Date
    Mar 2004
    Posts
    520
    Perhaps you should request this thread be moved to the windows programming board?

  3. #18
    Registered User
    Join Date
    Oct 2004
    Posts
    56
    I understand the Main now, What else do I need to do to fix the program so that it will at least run so that I can see what else is wrong?

    thank You

  4. #19
    Registered User
    Join Date
    Oct 2004
    Posts
    56
    Can someone Please Help me?

    Thank You

  5. #20
    cwr
    cwr is offline
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    No need to bump the thread. The reason that I've not replied further is because you clearly have a lack of understanding of very fundamental concepts of the C programming language, and I don't have a spare few hours to explain them to you. That might be the reason why others haven't replied. Suggest you read at least a few chapters of an introductory C book, especially on the ones pertaining to functions.

  6. #21
    Registered User
    Join Date
    Oct 2004
    Posts
    56
    I have read, but not really understanding it right. I have six books on the subject, and more papers printed from the web on functions. This is why I am here asking for help. Could you try and spend some time helping me?

    Thank You

  7. #22
    cwr
    cwr is offline
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    A C program with multiple functions might have this structure:
    Code:
    /* Some includes, for needed header files */
    #include <stdio.h>
    
    /* Some function declarations */
    double foo(int, int, int, double);
    
    /* A main function (in your Windows environment, apparently _tmain) */
    int main(void)
    {
        double x;
        /* some code that does stuff, calling your functions */
        x = foo(1,2,3,4.0);
        return 0;
    }
    
    /* the definitions of functions you declared above */
    double foo(int a, int b, int c, double d)
    {
        return a + b + c * d; /* made up pointless function */
    }
    The useless program above is valid, and explains how a correct looking program with use of a function is typically strutured. Yours is all over the place. Clearly declare your functions outside of any other functions, clearly have your main, clearly define your functions outside of any other functions. Don't put blocks ( { and } ) outside of functions.

    Notice also my indenting, it clearly shows what should belong where. If you still can't work out how to do this, post your code and comment liberally the structure. Before each function declaration and definition, and before each block of code, state what function it belongs to, then the problem should be self-evident.

  8. #23
    Registered User
    Join Date
    Oct 2004
    Posts
    56
    Ok I just printed out what you wrote and will try to see if I can fix what is wrong. I know I will be back.

    Thank You

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 12:45 PM
  2. dllimport function not allowed
    By steve1_rm in forum C++ Programming
    Replies: 5
    Last Post: 03-11-2008, 04:33 AM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21