Solved

Jagged Array in C++

Posted on 2003-11-06
3
1,321 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Exchange and Third Party application. 8 59
scoresClump  challenge 31 107
Replace a tag with sed 2 41
strDist challenge 35 84
This is an explanation of a simple data model to help parse a JSON feed
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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 …

763 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

6 Experts available now in Live!

Get 1:1 Help Now