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 8247691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:56:08+00:00 2026-06-07T22:56:08+00:00

I am getting the error – NullReferenceException was unhandled, in the following code. I

  • 0

I am getting the error – NullReferenceException was unhandled, in the following code. I want to extract characters from string pt. However I am getting correct value outside the for loops, but not the same inside it.

ArrayList list = read();
int N = Values.N;
string pt = Values.PlainText;
MessageBox.Show(""+pt.Length+" "+pt[0]);
int count = 0;
char[][][] array = new char[6][][];
for(int i=0;i<6;i++)
{
    for(int j=0;j<N;j++)
    {
        for(int k=0;k<N;k++)
        {
            if (count < pt.Length)
            {
                array[i][j][k] = 'r';
                //array[i][j][k] = pt[count];
                //count++;
            }
            else
            {
                array[i][j][k] = 'x';
            }
        }
    }
}
  • 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-06-07T22:56:09+00:00Added an answer on June 7, 2026 at 10:56 pm

    You have to initialise the second and third levels of the arrays, you can’t just assign elements. So:

    ArrayList list = read();
    int N = Values.N;
    string pt = Values.PlainText;
    MessageBox.Show(""+pt.Length+" "+pt[0]);
    int count = 0;
    char[][][] array = new char[6][][];
    for(int i=0;i<6;i++)
    {
        for(int j=0;j<N;j++)
        {
            array[i] = new char[N][]; // <---- Note
            for(int k=0;k<N;k++)
            {
                array[i][j] = new char[N]; // <---- Note
                if (count < pt.Length)
                {
                    array[i][j][k] = 'r';
                    //array[i][j][k] = pt[count];
                    //count++;
                }
                else
                {
                    array[i][j][k] = 'x';
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting error using the following code snippet jQuery(document).ready(function() { jQuery.ajax({ url: url, type:
iam getting error when initilize variable with value is from session.. my program like
I am getting error in APNS implementation I used code from here http://www.easyapns.com/apple-delegate I
Getting error with the following code: import java.util.Scanner; public class FahrenheitToCelsius{ public static void
I am getting abpve error at line str.append(ch); in below code. I basically want
Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data
Update getting error when i try to call the method from Activity: SQLiteDatabase db
I ma getting error like Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.Unit' in the
i am getting error: cannot convert to pointer type NSMutableDictonary *mydictonary; [mydictionary setValue: [mySlider.value
I'm getting error C3095: 'Xunit::Extensions::InlineDataAttribute': attribute cannot be repeated in C++/CLI code but not

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.