Pointers Issues

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • momotaro
    Contributor
    • Sep 2006
    • 357

    Pointers Issues

    this is the part of code that goes wrong...
    am havin a run time error
    [CODE=c]
    #include"common .h"

    voidDisplayMenu (int *);
    void main()


    {
    int*c;

    /*do
    {
    }while(UserSays Yes());*/
    DisplayMenu(&c) ;
    printf("%d", *c);

    }


    void DisplayMenu(int *c)


    {
    printf("1. Enter In-order Expression\n"
    "2. Conversion to Potfix\n"

    "3. In-Order Traversal\n"
    "4. Pre-Order Traversal\n"
    "5. Post-Order Traversal\n"
    "6. Quit\n\n"

    );

    scanf("%d", *c);

    }

    [/CODE]
  • ilikepython
    Recognized Expert Contributor
    • Feb 2007
    • 844

    #2
    Originally posted by momotaro
    this is the part of code that goes wrong...
    am havin a run time error
    [CODE=c]
    #include"common .h"

    voidDisplayMenu (int *);
    void main()


    {
    int*c;

    /*do
    {
    }while(UserSays Yes());*/
    DisplayMenu(&c) ;
    printf("%d", *c);

    }


    void DisplayMenu(int *c)


    {
    printf("1. Enter In-order Expression\n"
    "2. Conversion to Potfix\n"

    "3. In-Order Traversal\n"
    "4. Pre-Order Traversal\n"
    "5. Post-Order Traversal\n"
    "6. Quit\n\n"

    );

    scanf("%d", *c);

    }

    [/CODE]
    Try calling DisplayMenu like this:
    [code=c]
    DisplayMenu(c);
    [/code]

    Comment

    Working...