Thread: keeps on crashing

  1. #1
    Registered User
    Join Date
    Oct 2013
    Posts
    29

    keeps on crashing

    The program keeps on crashing when it finishes case 1
    Attached Files Attached Files

  2. #2
    Registered User camel-man's Avatar
    Join Date
    Jan 2011
    Location
    Under the moon
    Posts
    693
    Use code tags next time, and its this piece of code
    Code:
    scanf("%d", amount1); // Missing '&' before variable amount1

  3. #3
    Registered User
    Join Date
    Oct 2013
    Posts
    29
    I cant believe I missed that. Thank you.

    The problem has one more problem when it attempts to subtract the requests from the donations. It will take out the donations and reset the donations to 0, but the requests will remain the same and not subtract the amount of donations from it

  4. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Post the relevant code in code tags...
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,665
    > I cant believe I missed that. Thank you.
    Try using a compiler with lots of warnings.
    Code:
    $ gcc -c -Wall foo.c
    foo.c: In function `main':
    foo.c:45: warning: format argument is not a pointer (arg 2)
    foo.c:45: warning: format argument is not a pointer (arg 2)
    foo.c:97: warning: statement with no effect
    foo.c:102: warning: statement with no effect
    foo.c:114: warning: statement with no effect
    foo.c:120: warning: statement with no effect
    foo.c:132: warning: statement with no effect
    foo.c:138: warning: statement with no effect
    foo.c:150: warning: statement with no effect
    foo.c:156: warning: statement with no effect
    foo.c:168: warning: statement with no effect
    foo.c:174: warning: statement with no effect
    If you always do this and only run code with zero warnings, you'll fix all the dumb stuff before having to stare at the screen wondering why it's crashed again.

    You'll instead be staring blankly at the screen wondering what the interesting bug is that you'll have to find
    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.

  6. #6
    Registered User
    Join Date
    Oct 2013
    Posts
    5
    Yes,when I wanted to learn something new and compiled and started a bunch of codes(arrays,pointers)I always forgot the & and program crashes when it gets to that function. I also got stuck on: file dFILE;-you are suppose to write file as FILE - I kept getting an error in compiler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program crashing
    By AlexD in forum C Programming
    Replies: 2
    Last Post: 03-13-2012, 04:56 PM
  2. crashing
    By Tool in forum C++ Programming
    Replies: 4
    Last Post: 07-11-2010, 01:23 PM
  3. Crashing
    By SanderK in forum C++ Programming
    Replies: 1
    Last Post: 03-24-2009, 05:41 PM
  4. need help program crashing
    By tunerfreak in forum C++ Programming
    Replies: 14
    Last Post: 05-22-2006, 11:29 AM
  5. Crashing...
    By webren in forum C++ Programming
    Replies: 3
    Last Post: 04-17-2005, 01:09 AM