Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4081590
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:04:49+00:00 2026-05-20T18:04:49+00:00

I have already looked at some array topics but I am still stumped. I

  • 0

I have already looked at some array topics but I am still stumped.

I wish to add a new line to my jagged array – and am strugigng to get the syntax right..

        int[][] intJaggedArray = new int[7][];

        intJaggedArray[0] = new int[3] { 1, 1, 1 };
        intJaggedArray[1] = new int[3] { 2, 2, 2 };
        intJaggedArray[2] = new int[3] { 3, 3, 3 };
        intJaggedArray[3] = new int[3] { 4, 4, 4 };
        intJaggedArray[4] = new int[3] { 5, 5, 5 };
        intJaggedArray[5] = new int[3] { 6, 6, 6 };
        intJaggedArray[6] = new int[3] { 7, 7, 7 };

So now if i want to add

        intJaggedArray[0] = new int[3] { 1, 1, 2 };

so the array ends up being as shown below how do I acheive it – thanks in advance – A noob from England. (And a big thanks in advance)

        intJaggedArray[0] = new int[3] { 1, 1, 1 };
        intJaggedArray[0] = new int[3] { 1, 1, 2 };
        intJaggedArray[1] = new int[3] { 2, 2, 2 };
        intJaggedArray[2] = new int[3] { 3, 3, 3 };
        intJaggedArray[3] = new int[3] { 4, 4, 4 };
        intJaggedArray[4] = new int[3] { 5, 5, 5 };
        intJaggedArray[5] = new int[3] { 6, 6, 6 };
        intJaggedArray[6] = new int[3] { 7, 7, 7 };
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:04:50+00:00Added an answer on May 20, 2026 at 6:04 pm

    What do you want to do? Insert a line between 0 and 1? Or replace the existing line 0?

    Your line :

    intJaggedArray[0] = new int[3] { 1, 1, 2 }; 
    

    simply replaces the existing line 0.

    You can’t insert a line in an array. To do so, use a list instead:

    List<int[]> myList = new List<int[]>();
    myList.Add(new int[] {...});
    myList.Add(new int[] {...});
    myList.Add(new int[] {...});
    
    ...
    
    myList.Insert(1, new int[] {...});
    

    Or if you want to replace the existing line, then simply:

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What are some new and exciting programming languages? I have already looked at ruby
I'm quite new to Android but already have some experience with Java itself. Now
Quick question (and sorry if it's already been asked, I have looked but couldn't
I have already read some posts, but no one helped me with my problem.
I have already configured jboss 4.2.3, but i need to use jboss-mq. Looked at
i know, similar questions have been asked, and i've already looked through everything i
I have already googled and searched stackoverflow but I can find nothing related to
I have already some applets ready. I tried to run it on android tablet.
I've already looked at the other SO discussions but can't seem to find an
I've already realized some applications with a small graphical user interface. Nothing complex, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.