Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. beginner question in C#

beginner question in C#

Scheduled Pinned Locked Moved C#
helpcsharpdata-structurestutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nnnnnnnnnn
    wrote on last edited by
    #1

    Hi I am just starting programing in C# and I couldn't figure out how to do this. I have a function which returns a single dimensional array. Now I have to call this function 10 times and put this into a double dimensional array. i did this: /***********************************************************/ int[,] output = new int[10,100]; for(int i=0; i<10; i++) output[i] = func(); --- func returns int[100] /***********************************************************/ But it is giving error that output[i] should have two arguments. Any help would be greatly appreciated bart

    S R 2 Replies Last reply
    0
    • N nnnnnnnnnn

      Hi I am just starting programing in C# and I couldn't figure out how to do this. I have a function which returns a single dimensional array. Now I have to call this function 10 times and put this into a double dimensional array. i did this: /***********************************************************/ int[,] output = new int[10,100]; for(int i=0; i<10; i++) output[i] = func(); --- func returns int[100] /***********************************************************/ But it is giving error that output[i] should have two arguments. Any help would be greatly appreciated bart

      S Offline
      S Offline
      Steven Behnke
      wrote on last edited by
      #2

      You'll need to do something like this... int[,] output = new int[10, 100]; for (int i = 0; i < 10; i++) output[i,0] = func();

      1 Reply Last reply
      0
      • N nnnnnnnnnn

        Hi I am just starting programing in C# and I couldn't figure out how to do this. I have a function which returns a single dimensional array. Now I have to call this function 10 times and put this into a double dimensional array. i did this: /***********************************************************/ int[,] output = new int[10,100]; for(int i=0; i<10; i++) output[i] = func(); --- func returns int[100] /***********************************************************/ But it is giving error that output[i] should have two arguments. Any help would be greatly appreciated bart

        R Offline
        R Offline
        Ryan Cromwell
        wrote on last edited by
        #3

        output is not a 2 dimensional array. its a 1-dimen. array which happens to be maintaining another 1-dim array. /***********************************************************/ int[,] output = new int[10]; for(int i=0; i<10; i++) output[i] = func(); --- func returns int[100] /***********************************************************/

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups