Making a script with arbitrary array length

This is a discussion on Making a script with arbitrary array length within the Linux Programming forums, part of the Platform Specific Boards category; Hey guys, I'm sort of new to scripting in Linux, but so far I think I'm getting the hang of ...

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    10

    Making a script with arbitrary array length

    Hey guys,

    I'm sort of new to scripting in Linux, but so far I think I'm getting the hang of it, execpt one part.

    I would like to create an array of whatever length the user provides in tcsh.

    They say make an already filled array, like
    Code:
    set numbers = (one two three four five)
    or make a blank one
    Code:
    set shapes = ("" "" "" "" "")
    I want to turn this C line into a tcsh line.
    Code:
     int data[100];
    Anyone know how to do this?
    Thanks!

  2. #2
    .
    Join Date
    Nov 2003
    Posts
    307
    You're stuck with something like
    Code:
    set data=( 0 0 0 0 0 0 0 0 0 0 \
     0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... )
    Script languages are not meant to do some of the things that perl, python, C, etc. can do.

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    10
    Yeah I was sort of figuring that. Thanks for the help!

  4. #4
    .
    Join Date
    Nov 2003
    Posts
    307
    Really - if you have an array that big use perl - or python - unless this is for a class.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 05-29-2009, 08:25 PM
  2. the length of my array is not what I expected
    By luca in forum C Programming
    Replies: 7
    Last Post: 12-05-2006, 03:14 AM
  3. Help with an Array
    By omalleys in forum C Programming
    Replies: 1
    Last Post: 07-01-2002, 09:31 AM
  4. making an empty 2-D array
    By starX in forum C Programming
    Replies: 4
    Last Post: 02-08-2002, 01:09 AM
  5. making an array name a variable
    By Zaarin in forum C++ Programming
    Replies: 5
    Last Post: 09-02-2001, 07:17 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21