• Save
C++ arrays part2
Upcoming SlideShare
Loading in...5
×
 

C++ arrays part2

on

  • 1,016 views

Hi friends these array series presentation gives you clear cut knowledge in array in c++ programming, array in c++ tutorial, array in c++ syntax, array in c++ example

Hi friends these array series presentation gives you clear cut knowledge in array in c++ programming, array in c++ tutorial, array in c++ syntax, array in c++ example

Statistics

Views

Total Views
1,016
Views on SlideShare
1,005
Embed Views
11

Actions

Likes
2
Downloads
0
Comments
0

2 Embeds 11

http://www.slideshare.net 7
http://alef.fiit.stuba.sk 4

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial LicenseCC Attribution-NonCommercial License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

C++ arrays part2 C++ arrays part2 Presentation Transcript

  • Arrays part -2 Author – Subhasis Nayak
  • Do & Don’t
  • Multidimensional arrays • Arrays can, however, get multidimensional too. • We can create an array of any number of dimensions, and that is what makes multidimensional arrays an interesting topic from mathematical points of view.
  • Declaring multidimensional array • Each dimension in an array is represented as a subscript in the array. Hence for – Two-dimensional array has two subscripts – three-dimensional array has three subscripts – & so on int twoDi_array[2][2];
  • Continue ….. • Keep in mind – first subscript = rows – Second subscript = columns int twoDi_array[2][2];
  • Positions 0 1 0 00 01 1 10 11
  • Example chess board • Board[8][8]; 00 01 02 03 04 05 06 07 10 20 30 40 50 60 70
  • Initializing Multidimensional Arrays • Initialization can be done as for uni dimensional array – Int Array[5][3] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
  • Continue ….. • For sake of clarity and readability we can write like this way also 1 2 3 – int Array[5][3] = { {1,2,3}, 4 5 6 {4,5,6}, 7 8 9 {7,8,9}, 10 11 12 {10,11,12}, 13 14 15 {13,14,15} };
  • • The compiler ignores the inner braces, but they do make it easier to understand how the numbers are distributed. • When initializing elements of an array, each value must be separated by a comma, with-out regard to the braces. • The entire initialization set must be within braces & it must end with a semicolon.
  • Program 01
  • Program 02
  • Program – 03(part-1)
  • Program – 03(part-2)