Solved

Jagged Array in C++

Posted on 2003-11-06
3
1,329 Views
Last Modified: 2012-06-22
Create a jagged array named foo in C++.  Row 0 will contain the integers 1,2; row 1 will contain 4,3,3,0; and row 2 will contain 5,6.
0
Comment
Question by:Xirom431
3 Comments
 
LVL 11

Expert Comment

by:bcladd
ID: 9696560
This sounds a lot like homework. It is agains EE policy for members to do homework OR for members to request solutions to homework. Has something to do the "academic honesty".

That said, what do you know how to do in C++? Show us your code so far and we would be happy to answer your specific questions.

-bcl
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9696715
Agree.  Who is your instructor?  Foo was the favorite example variable of an teaching buddy of mine.

mlmcc
0
 
LVL 5

Accepted Solution

by:
waelothman earned 100 total points
ID: 9698857
if i understand write you want 2 dim. array without fixing the dimention
contain 3 rows the 1st row contain 4 elements and the second contain 4 elements and the 3ed conatin 2 elements
this can be done by creating array of pointer as

int *  foo[3];
foo[0] = new int[2];
foo[0][0]=1;foo[0][1]=2;
foo[1] = new int[4];
foo[1][0]=4;foo[1][1]=4;foo[1][2]=4;foo[1][3]=0;
foo[2] = new int[2];
foo[2][0]=5;foo[2][1]=6;

but i want to add if this is homework try to know why we think like that the solution itself not the problem ,but the problem always in the way of thinking
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now