need help for stack problem again

This is a discussion on need help for stack problem again within the C++ Programming forums, part of the General Programming Boards category; >> it holds chars and ints An array cannot hold more than one type. If you are storing more than ...

  1. #16
    Registered User
    Join Date
    Jan 2005
    Posts
    7,344
    >> it holds chars and ints
    An array cannot hold more than one type. If you are storing more than one type of data in an array, you put that data into a struct. That struct is a type. Then your array holds that type.

    So in your case, while your array does hold chars and ints, those chars and ints are held inside a struct named car. It is that type that you should use declare your array.

    Do you see how the spaces array holds cars, not chars and ints?

  2. #17
    Registered User
    Join Date
    Sep 2006
    Posts
    15
    ok, I think I fix every thing, no errors but 2 warnnig
    this is a warning:
    local variable 'Hr' used without having been initialized
    local variable 'Min' used without having been initialized

  3. #18
    Registered User
    Join Date
    Jan 2005
    Posts
    7,344
    Those probably need to be initialized. Perhaps by using milhours and milmin?

  4. #19
    Registered User
    Join Date
    Sep 2006
    Posts
    15
    what do you mean by milhours and milmin?

  5. #20
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,479
    >what do you mean by milhours and milmin?

    Local variables need to be assigned a value, Daved was giving you an example
    I'm just trying to be a better person - My Name Is Earl

  6. #21
    Registered User
    Join Date
    Jan 2005
    Posts
    7,344
    >> what do you mean by milhours and milmin?
    Hr and Min are being used without having any value given to them. That function takes a parameter called milhours and one call milmin. My guess is that you use those values to initialize Hr and Min to some value so you can use them in your function.

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

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 05:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM

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