473,472 Members | 2,241 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Pointers Issues

momotaro
357 Contributor
this is the part of code that goes wrong...
am havin a run time error
Expand|Select|Wrap|Line Numbers
  1. #include"common.h"
  2.  
  3. voidDisplayMenu(int *);
  4. void main()
  5.  
  6.  
  7. {
    int*c;
  8.  
  9. /*do
  10. {
  11. }while(UserSaysYes());*/
  12. DisplayMenu(&c); 
  13. printf("%d", *c);
  14.  
  15. }
  16.  
  17.  
  18. void DisplayMenu(int *c)
  19.  
  20.  
  21. {
    printf("1. Enter In-order Expression\n"
    "2. Conversion to Potfix\n"
  22.  
  23. "3. In-Order Traversal\n"
  24. "4. Pre-Order Traversal\n"
  25. "5. Post-Order Traversal\n"
  26. "6. Quit\n\n"
  27.  
  28. );
  29.  
  30. scanf("%d", *c);
  31.  
  32. }
  33.  
  34.  
Oct 27 '07 #1
1 1126
ilikepython
844 Recognized Expert Contributor
this is the part of code that goes wrong...
am havin a run time error
Expand|Select|Wrap|Line Numbers
  1. #include"common.h"
  2.  
  3. voidDisplayMenu(int *);
  4. void main()
  5.  
  6.  
  7. {
    int*c;
  8.  
  9. /*do
  10. {
  11. }while(UserSaysYes());*/
  12. DisplayMenu(&c); 
  13. printf("%d", *c);
  14.  
}
  •  
  •  
  • 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);
  •  
  • }
  •  
  •  
  • Try calling DisplayMenu like this:
    Expand|Select|Wrap|Line Numbers
    1. DisplayMenu(c);
    2.  
    Oct 28 '07 #2

    Sign in to post your reply or Sign up for a free account.

    Similar topics

    8
    by: rihad | last post by:
    Hi, I've this question: suppose we have two differently typed pointers: struct foo *foo; char **array; Becase one can always legally cast any pointer to (void *), and becase (void *) is...
    11
    by: grocery_stocker | last post by:
    How come you can subtract pointers, but you cannot add them?
    59
    by: MotoK | last post by:
    Hi Experts, I've just joined this group and want to know something: Is there something similar to smart pointers in C or something to prevent memory leakages in C programs. Regards MotoK
    7
    by: Karim | last post by:
    Hi, There is a certain structure that I need and I am planning to implement but I wanted to make sure nothing similar that already exists. My main objective is to have a vector that mainly...
    38
    by: James Brown | last post by:
    All, I have a quick question regarding the size of pointer-types: I believe that the sizeof(char *) may not necessarily be the same as sizeof(int *) ? But how about multiple levels of pointers...
    64
    by: Zytan | last post by:
    I know there are no pointers in C#, but if you do: a = b; and a and b are both arrays, they now both point to the same memory (changing one changes the other). So, it makes them seem like...
    11
    by: subramanian100in | last post by:
    Given that the sizes of pointers to different data types(built-in or structures) can be different, though malloc returns a void *, it is assigned to any pointer type. The language allows it. From...
    21
    by: Randy | last post by:
    Hi, I am a noob. I am trying to store Student objects pointers, in a vector, within a School object. I call a setter function to add the pointer. If I use this method it works, Student st =...
    54
    by: Boris | last post by:
    I had a 3 hours meeting today with some fellow programmers that are partly not convinced about using smart pointers in C++. Their main concern is a possible performance impact. I've been explaining...
    69
    by: Yee.Chuang | last post by:
    When I began to learn C, My teacher told me that pointer is the most difficult part of C, it makes me afraid of it. After finishing C program class, I found that all the code I wrote in C contains...
    0
    by: Hystou | last post by:
    There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
    0
    marktang
    by: marktang | last post by:
    ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
    0
    by: Hystou | last post by:
    Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
    1
    by: Hystou | last post by:
    Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
    0
    tracyyun
    by: tracyyun | last post by:
    Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
    1
    isladogs
    by: isladogs | last post by:
    The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
    0
    by: adsilva | last post by:
    A Windows Forms form does not have the event Unload, like VB6. What one acts like?
    0
    by: 6302768590 | last post by:
    Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
    0
    muto222
    php
    by: muto222 | last post by:
    How can i add a mobile payment intergratation into php mysql website.

    By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

    To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.