• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt in this arrary example.  RSS feed

 
omkar patkar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
i was experimenting with arrays. i have written following program :-



//********************************************************
The output of the program is :-

The no of elements in multidimensional arrary are 21 ...how come 21 ?
Is the element value marked in quotes an empty value ?

Can some one please tell me how the no of elements present in the array are 21 0r 20 or 19 ? ...and why ?

Many thanks
Omkar !
 
omkar patkar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many Apologies ! ...actually the other half of the code looks something like this :-



I forgot to mention the part in Bold which i have highlighted over here !
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the "mulArray[2]" that you are referencing?

Henry
 
Campbell Ritchie
Marshal
Posts: 55761
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The no of elements in multidimensional arrary are 21 ...how come 21 ?
  • There is one in newMultiArray[0].
  • There are two in newMultiArray[1].
  • There are four in newMultiArray[2].
  • There is none in newMultiArray[3].
  • There are ten in newMultiArray[4]. That makes 17.
  • There must be four in mulArr[2], which makes 21.
  •  
    Campbell Ritchie
    Marshal
    Posts: 55761
    163
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    . . . and I think your isRectangularArray will not tell you whether it is rectangular, eg 3 * 4, 4 * 5, but only square, eg 4 * 4, 5 * 5.
     
    omkar patkar
    Ranch Hand
    Posts: 231
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I am so sorry ! ...such a fool of me ! ..... actually mulArray does contains 4 elements ! ...i had declared actually many arrays mulArray being one of them and forgot to copy paste it over here ! ...
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!