im getting segemented fault error here when i enter 100000 for row and question. would i have to create this array in heap or am i doing something else wrong?
so the code is gets 2 inputs first tells how many rows are created and second is how many questions are asked
then each row gets a number telling that row to contain that much element.
then a question is asked where it gets the row and index of that row's element.
It's not surprising that a 40 gigabyte array won't fit on the stack, or in memory at all, really.
What the fuck are you filling it with?
At any rate, since you're obviously writing a C program (scanf, printf, VLA), you should use C headers (i.e., <stdio.h>) and ensure that you compile it as C.
im writing a c++ program. i heard many companies still used printf and scanf instead of std::cin and std::cout so im getting used to writing both.
and im filling the array with random ints.
The stack's memory space is in the magnitude of a few MB. You're trying to allocate 40 GB, as dutch said. Won't work.
In addition, array sizes must be known at compile-time. Your lines 6 and 14 are Variable-Length Arrays (VLA), and are not legal C++. If you're just practicing, just make a sanely-sized array, like 100x100, and don't let the user enter a number above that.