Pascal�s Triangle
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
int [] [] p;
p = new int[7][]; // p.length is 7
p[0] = new int[1]; // p[0].length is 1
p[1] = new int[2]; // p[1].length is 2
p[2] = new int[3]; // p]2].length is 3
Note: Elements of an array can be
arrays of different lengths!
Previous slide
Next slide
Back to first slide
View graphic version