Ad
  • Default User Avatar
  • Default User Avatar

    it's C, and I have the exact same problem...

  • Default User Avatar

    Hi, glad to hear you're new to C and trying to understand new concepts. Shortly, this is what we call a dynamic 2D array, in C an array is a pointer (in this case array of ints so it's a pointer on an int).
    Therefore, if you would like to create a 1D array you'll need to create a pointer on the datatype you want (in this case int), and then allocates memory for it.
    But since this is a 2D array you'll need to create a pointer on pointer (which is the double pointer you mentionned) and then for every element of the 2D array you'll need to allocate another array since you want a 2D, because if we can say that a 2D array is a 1D array inside of another one,
    I hope I made some things clear hear, it's a very complex concept since it works with pointers but there you have it (you can also type dynamic 2D array in C on Google if you need clearer idea).

  • Default User Avatar

    damn, what's that