Thread: Strange error with array

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    3

    Strange error with array

    I'm working on a project for school in which we make an array and allow the user to add/delete products from the array. I've made it pretty far but I'm encountering a MASSIVE error when I try to compile it after I add in the code to add info to the price and/or quantity array (I'm assuming this has to do with the fact that they're doubles and ints respectively and not chars, though in all honesty, I have no idea what the problem is).

    Here's the code for the whole program:

    <<< try again >>>

    NOTE: I am not looking for someone to tell me how to do my program, I'm just asking for some help on this one issue. Thanks in advance.

    EDIT: /facepalm. After posting this thread and I tried to explain what I thought the error was, I was able to think it out and correct it. I changed the Pri and Qua arrays to chars rather than ints and now it's working fine. Sometimes just posting things and thinking about them a little further solves the problem

    Disregard this post and if any mods/admins would like to close it, please do.
    Last edited by Smallpox; 02-03-2011 at 10:50 PM. Reason: /facepalm; identified error.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I think you should read this, before anyone would bother to read that ^^^^
    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.

  3. #3
    Registered User
    Join Date
    Jan 2011
    Posts
    3
    Quote Originally Posted by Salem View Post
    I think you should read this, before anyone would bother to read that ^^^^
    And I think you should read this before posting anything. Obviously I already fixed it, so you posting anything doesn't really help. Trying to get your post count up much?

    Quote Originally Posted by Smallpox View Post

    EDIT: /facepalm. After posting this thread and I tried to explain what I thought the error was, I was able to think it out and correct it. I changed the Pri and Qua arrays to chars rather than ints and now it's working fine. Sometimes just posting things and thinking about them a little further solves the problem

    Disregard this post and if any mods/admins would like to close it, please do.

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Quote Originally Posted by Smallpox View Post
    And I think you should read this before posting anything. Obviously I already fixed it, so you posting anything doesn't really help. Trying to get your post count up much?
    Salem - Smallpox => 0 - 1
    Devoted my life to programming...

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Funny, it still looks like unindented crap to me.

    I can fix that for you.

    There - much better.

    > Trying to get your post count up much?
    I've been here over a decade - why should I give a frig what some oik with 3 posts thinks about post counts.
    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
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Don't be so picky, Salem. The guy was just making a joke.
    Devoted my life to programming...

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    yeah - whatever.
    If they post more unindented code, I'll just do the same until they learn.
    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.

  8. #8
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    How do they say it: Sticks and stones may break my bones but words will never hurt me?
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ordering an array in a 'strange' order.
    By Ziden in forum C++ Programming
    Replies: 3
    Last Post: 05-11-2010, 09:21 PM
  2. Code: An auto expanding array (or how to use gets() safely).
    By anonytmouse in forum Windows Programming
    Replies: 0
    Last Post: 08-10-2004, 12:13 AM
  3. Array help
    By deedlit in forum C Programming
    Replies: 4
    Last Post: 11-05-2003, 10:55 AM
  4. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM
  5. Array Program
    By emmx in forum C Programming
    Replies: 3
    Last Post: 08-31-2003, 12:44 AM