Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. about array creation

about array creation

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++data-structuresdebugging
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DSPCottage
    wrote on last edited by
    #1

    Dear all in visual C++ 6 I want to create an array of class objects like this : declaration in header file : CStateMachine *state[NumberOfChannels]; in constructor : for (int i=0; i < NumberOfChannels ; i++) { states[i] = new CStateMachine(this); } in destructor : for (int i=0; i < NumberOfChannels ; i++) { delete states[i] ; } But when I want to delete the file I get the following error DAMAGE : after normal block (#210) at 0x13243214 Press any key to debug the application Abort, retry, Ignore. May you please help me to find the reason of this problem. Regards

    D K 2 Replies Last reply
    0
    • D DSPCottage

      Dear all in visual C++ 6 I want to create an array of class objects like this : declaration in header file : CStateMachine *state[NumberOfChannels]; in constructor : for (int i=0; i < NumberOfChannels ; i++) { states[i] = new CStateMachine(this); } in destructor : for (int i=0; i < NumberOfChannels ; i++) { delete states[i] ; } But when I want to delete the file I get the following error DAMAGE : after normal block (#210) at 0x13243214 Press any key to debug the application Abort, retry, Ignore. May you please help me to find the reason of this problem. Regards

      D Offline
      D Offline
      DSPCottage
      wrote on last edited by
      #2

      "But when I want to delete the classes I get the following error" is correct.

      1 Reply Last reply
      0
      • D DSPCottage

        Dear all in visual C++ 6 I want to create an array of class objects like this : declaration in header file : CStateMachine *state[NumberOfChannels]; in constructor : for (int i=0; i < NumberOfChannels ; i++) { states[i] = new CStateMachine(this); } in destructor : for (int i=0; i < NumberOfChannels ; i++) { delete states[i] ; } But when I want to delete the file I get the following error DAMAGE : after normal block (#210) at 0x13243214 Press any key to debug the application Abort, retry, Ignore. May you please help me to find the reason of this problem. Regards

        K Offline
        K Offline
        kcynic
        wrote on last edited by
        #3

        If the CStateMachine's destructor would delete the pointer which store something(here is its parent:this). if so,I think you should check it. And,if you debug it and trace,you should find where the crash occur. good luck

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups