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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:43:54+00:00 2026-05-28T16:43:54+00:00

Lets say I have an array of chars which I have inputted from in

  • 0

Lets say I have an array of chars which I have inputted from in console. How can I write them into two-dimensional array in the following way:

1 6 11 16 21

2 7 12 17 22

3 8 13 18 23

4 9 14 19 24

5 10 15 20 25

Or would it be better to use Lists?

Thank you!

  • 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-28T16:43:54+00:00Added an answer on May 28, 2026 at 4:43 pm

    Assuming you have the inputs in a single-dimensional array of length 25:

    let inputs = [| 1 .. 25 |]
    

    You can create a two-dimensional array that stores the data in a 5×5 grid using the Array2D.init function:

    let arr = Array2D.init 5 5 (fun i j -> inputs.[j*5 + i])
    

    The function initializes the array using the specified size (first two parameters) and calls the provided function to fill the value for every element of the array. By accessing the element at index j*5 + i, you get the structure that you wanted in your sample.

    EDIT You cannot append a row to an array (array has a fixed size), but you can easily create a larger array and copy data there:

    let bigger = Array2D.zeroCreate 6 5
    // Copy the whole contents of the original array
    bigger.[0..4, 0..4] <- arr     
    // Write new data to the last row
    bigger.[5..5, 0..4] <- array2D [[5;10;15;20;25]]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have an array which has n dimensions. Now in order to
Lets say i have the following cstring char array[1000]; How i can convert it
I have run into an interesting problem lately: Lets say I have an array
Lets say I have a char array that contains the sequences of chars: robots
Lets say I have an array like this: string [] Filelist = ... I
Lets say I have this array, int[] numbers = {1, 3, 4, 9, 2};
Lets say I have an array numbers that contains the following values: int numbers
Lets say I have an array of length n and I want to pick
Lets say I have an array with a structure like this: $arr= Array( array(
Lets say I have an array : a=[[1,2,3],[4,5]] and I have another array :

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.