Free question

This is a discussion on Free question within the C Programming forums, part of the General Programming Boards category; Does the free function deallocate the memory of matrices of pointers? Code: int **matrix; int i; matrix = (int **) ...

  1. #1
    Disturbed Boy gustavosserra's Avatar
    Join Date
    Apr 2003
    Posts
    244

    Free question

    Does the free function deallocate the memory of matrices of pointers?
    Code:
       int **matrix;
       int i;
       matrix = (int **) malloc ( NUMBER );
       for(  i = 0 ; i < NUMBER ; i++ )
           matrix[i] = (int *)malloc(  ANOTHER_N );
       }
    
        free(matrix);
    Nothing more to tell about me...
    Happy day =)

  2. #2
    Registered User
    Join Date
    Jul 2003
    Posts
    102

    free

    free memory occupied by ANOTHER_N and then free NUMBER.
    Saravanan.T.S.
    Beginner.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Design question
    By MacGyver in forum C Programming
    Replies: 9
    Last Post: 05-17-2007, 02:36 AM
  2. Simple question about free()
    By fanoliv in forum C Programming
    Replies: 7
    Last Post: 06-16-2006, 11:14 AM
  3. question about free()
    By TalosChen in forum C Programming
    Replies: 5
    Last Post: 05-20-2006, 06:11 PM
  4. SIGABRT upon free()
    By registering in forum C Programming
    Replies: 2
    Last Post: 07-19-2003, 07:52 AM
  5. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 02:57 PM

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