answersLogoWhite

0

A matrix is a two-dimensional array of objects. If, for instance, you wanted a 10 by 20 matrix (array) of doubles, you would say...

double mydoublearray[10][20];

You would then refer to each element with the syntax...

double somedouble;
somedouble = mydoublearray[3][7];

Note that array indices start from zero, and go to the declared size minus one, so the first element is mydoublearray[0][0]and the last element is mydoublearray[9][19].

You can have arrays of elementary types and of classes. The syntax is the same. Just use the class name instead of the word double.

User Avatar

Wiki User

15y ago

Still curious? Ask our experts.

Chat with our AI personalities

EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
BlakeBlake
As your older brother, I've been where you are—maybe not exactly, but close enough.
Chat with Blake

Add your answer:

Earn +20 pts
Q: Give an example of matrix in c plus plus program?
Write your answer...
Submit
Still have questions?
magnify glass
imp