How to find a largest size of 2D arrays in C language?

timer Asked: Apr 5th, 2015

Question description

This is the homework question:

By trial and error, discover what the largest value of x can be in the following program so that it still compiles and runs without error:main(){
  int array[x][x];
  array[0][0] = 0;

Print this value of x at the start of your submission.  Then use malloc to create a 5000 by 5000 square array.  Fill this array with random numbers in the range [0, 6].  Iterate through the array again, counting the number of times each value appeared.

Sample session (note: for the purpose of this sample, the value of x is incorrect.  You should discover this value on your own.)
x = 12
there are 3570129 0s
there are 3570751 1s
there are 3571904 2s
there are 3573195 3s
there are 3571223 4s
there are 3568653 5s
there are 3574145 6s

[please answer in C language, Thanks!]

Tutor Answer

(Top Tutor) Studypool Tutor
School: UIUC
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors