Thread: 2D Arrays

  1. #1
    Registered User
    Join Date
    May 2017

    2D Arrays


    If i have a number sequence for Example
    1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 and maximum columns in the array is 5. if i input the above then the program should display in 2D array formats as below choice for the use is to key board input the values.

    TABLE: 1 5 9 12 15
    2 6 10 13 16
    3 7 11 14 17
    4 8

    Output Image
    2D Arrays-11111-jpg

    How To Do This Part?
    Last edited by SeanDerik; 05-04-2017 at 12:46 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    What have you tried?

    Also, think about what happens if the user inputs say 16 numbers, or 18 numbers.

    Or they choose a column number other than 5.

    Knowing what you're supposed to do in other cases helps to figure out the algorithm to solve all cases.

    For example, the number of 'long' columns is apparently 17 % 5 (which is 2). But is that just me, or what you really want?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Passing arrays and string arrays to functions
    By codeer in forum C Programming
    Replies: 2
    Last Post: 03-25-2015, 10:07 AM
  2. Replies: 9
    Last Post: 07-11-2013, 10:57 PM
  3. Replies: 16
    Last Post: 01-01-2008, 04:07 PM
  4. Passing pointers to arrays of char arrays
    By bobthebullet990 in forum C Programming
    Replies: 5
    Last Post: 03-31-2006, 05:31 AM
  5. Replies: 2
    Last Post: 02-23-2004, 06:34 AM

Tags for this Thread