Q. How many values can be stored by an array A(-1...m,1...m)?
a. m
b. m2
c. m(m+ 1)
d. m(m+2)
I am not getting any clue what's the output, can anyone help me out with correct option and explanation
thanks a lot in advance
Q. How many values can be stored by an array A(-1...m,1...m)?
a. m
b. m2
c. m(m+ 1)
d. m(m+2)
I am not getting any clue what's the output, can anyone help me out with correct option and explanation
thanks a lot in advance
Consider a few values of m, list out the elements, and count. You should be able to spot some kind of pattern.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
You should know which programming language the question is about. From where did you copied it?
I would say it's pseudocode and thus a general question.
Do the calculation yourself then come back, tell us what you think the answer is and why.
Bye, Andreas
I am solving some question on the net I found that there, but I am unable to solve it , I just want example of the declaration, so I can think further
C doesn't support negative indices in arrays. You can answer the question and make the program, by using an offset of -1, in the first range of indices, however.
But you can't make array declarations in C, that strictly match up with the index numbers you have given in your first post.
As AndiPersti replied above, it has to be pseudo code if the language is C. If it's for another language, I'd guess it's Pascal(Delphi), since that language was created to help teach programming, and it uses array syntax like that.
There are hundreds of C examples of array declarations on this web site. If you are still confused, click on the "C Tutorial" button, near the top (center) of this page, and go through some of it.
One of the beautiful things about programming is, you can try out different syntax's and blocks of code, in very little time.
I am not going to spoon feed you on this. You've already been told the answer, and more. Either you want to work on it, or you don't. Choice is yours.