Access violation writing location 0x00000004.

Discussion in 'C' started by imported_zatlas1, Sep 8, 2010.

  1. imported_zatlas1

    imported_zatlas1 New Member

    Joined:
    Sep 8, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi all
    I have this code that appears to be simple enough
    Code:
    #define TEST_LIMIT 100
            .
            .
            .
    
    struct menu_info {        
            long rpt_options;        
            long rpt_default;        
            char **narr_menu;        
            char **plot_menu;        
            char **eqns_menu;        
            char **cust_menu;        
    };
            .
            .
            .
    
            struct menu_info *M[TEST_LIMIT];
            .
            .
            .
    
    void main(int argc, char **argv)
    {
            .
            .
            .
    
            for(i = 0; i < TEST_LIMIT; i++)
                    M[i]->rpt_default = 0L;
    
    on the first iteration (i.e i=0) I get this message:
    Unhandled exception at 0x013d3406 in myprogram.exe: 0xC0000005: Access violation writing location 0x00000004.

    Before getting into the for loop, M appears to be correct and pointing to where it supposed to.

    Any clue anybody?
    Thanks
    ZA
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice