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. Initialize array in one line / in a single statement

Initialize array in one line / in a single statement

Scheduled Pinned Locked Moved C#
data-structureshelptutorialquestion
22 Posts 8 Posters 1 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 NetQuestions

    I actually used the following statement

    string str = new string('*', 10)

    P Offline
    P Offline
    PIEBALDconsult
    wrote on last edited by
    #21

    That doesn't meet the stated criteria.

    1 Reply Last reply
    0
    • N NetQuestions

      Hi, recursion is not always the way.

      *
      *
      *
      **
      ***
      *****
      ********

      If I were to generate and display the following, you will observe that when n= 50, program hangs. the number of times recursive method gets called grows exponentially. In such a case a non recursive method is required. Regards, NetQuestions

      A Offline
      A Offline
      Andrew Rissing
      wrote on last edited by
      #22

      Indeed, I'm well aware of such. I was only basing my suggestion on the fact it seemed like a homework assignment to create a recursive method. :)

      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