Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7853663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:45:53+00:00 2026-06-02T19:45:53+00:00

I was solving some simple pointer exercises when i came across the following example:

  • 0

I was solving some simple pointer exercises when i came across the following example:

void deallocate2D(int** array, int nrows) {     
 /*  deallocate each row  */
 int i;
 for(i = 0; i < nrows; i++) {
      free(array[i]);
 }

 /*  deallocate array of pointers  */
 free(array);     
}

The array is defined in main as int** array1;

Is this a correct way of deallocating memory of a 2d array or should an int*** array be passed in the function instead?
Is there a way to check that memory has been successfully deallocated?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:45:57+00:00Added an answer on June 2, 2026 at 7:45 pm

    Yes, that’s correct. int*** is only necessary if you intend to change the value of the pointer, which you don’t need to.

    There do exist tools which can check your memory allocations/frees – Valgrind should be able to do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to solve some simple equations in .NET. I came across Math.NET and
I'm solving simple math task, and I have faced with some problems. I have
I would like to build some simple application - for example Todo list -
Hello everyone I'm trying to improve my Java skills by solving some problems from
I need some help in solving this problem. We have a large amount of
I have a problem that I'm hoping to get some direction in solving -
While solving exercises from the K&R C book, I stumbled upon the exercise 2.1.
Working on solving a simple problem in C++, want to understand how I could
While solving some Project Euler Problems to learn Haskell (so currently I'm a completly
Ive gotten some great help here and I am so close to solving my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.