PASSING 2D ARRAY

program just stops working when i execute it
i need to pass an array of size [1024][10], if i decrease the size of the array it starts working. but it is not my requirement.

#include<iostream>

using namespace std;

void show(int array[][10])
{
cout<<array[0][0];
//some other operations

}

int main()
{
int arr[1024][10];
arr[0][0] = 2;
show(arr)
}
closed account (D80DSL3A)
Please show the code that's causing the problem.
The rest of the show() function may reveal the problem.
Last edited on
The above code has an error dude. Not a syntax error but any other
There is no immediate error with the code you presented (aside from the semicolon you're missing when you call show). If you're having issues, it's not directly related to the code that you have presented us. And as fun2code pointed out, you need to share more of your code before we're going to be able to effectively debug it for you. Also, you haven't specified exactly what happens. The program stops working isn't enough information. Does it freeze? Does it crash? What happens immediately before doing the above?

There is too many unknowns here and we're not fortune tellers and can't see your code unless you share it with us. If you want us to take guesses, fine, but most of us won't attempt to do that. I'm assuming your program is crashing and it's due to a memory access violation due to going out of bounds of your array. With that being said, you need to modify certain loops etc. so that your array, and when accessing values of said array, don't exceed the declared size of it. Your function, or something else in your code is to blame, but not what you've shown us.
Topic archived. No new replies allowed.