Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Scotland
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    arrays and things...

    i have this:

    Code:
          while (idx<100)
          {
            Get5017H(3,i,&(val0[idx]));
            Get5017H(3,i,&(val1[idx]));
            Get5017H(3,i,&(val2[idx]));
            Get5017H(3,i,&(val3[idx]));
            Get5017H(3,i,&(val4[idx]));
            Get5017H(3,i,&(val5[idx]));
            Get5017H(3,i,&(val6[idx]));
            Get5017H(3,i,&(val7[idx]));
            idx++;
          }
    but i'd like to run it with a for loop something like:
    Code:
    while(idx<100)
    {
      for(k=0;k<8;k++)
      {
        Get5017H(3,i,&(val[k][idx]));
      }
    }
    it's the [k][idx] thing i'm not sure about. I'm pretty sure the above wont work. Any suggestions??
    My body's a temple... and like those ancient Greek ones it's a ruin
    sweenster.co.uk

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    I assume then your ultimate goal is to loop through the values like so:

    Get5017H(3,i,&(val0[0]));
    Get5017H(3,i,&(val1[0]));
    Get5017H(3,i,&(val2[0]));
    Get5017H(3,i,&(val3[0]));
    Get5017H(3,i,&(val4[0]));
    Get5017H(3,i,&(val5[0]));
    Get5017H(3,i,&(val6[0]));
    Get5017H(3,i,&(val7[0]));

    Get5017H(3,i,&(val0[1]));
    Get5017H(3,i,&(val1[1]));
    Get5017H(3,i,&(val2[1]));
    Get5017H(3,i,&(val3[1]));
    Get5017H(3,i,&(val4[1]));
    Get5017H(3,i,&(val5[1]));
    Get5017H(3,i,&(val6[1]));
    Get5017H(3,i,&(val7[1]));

    Get5017H(3,i,&(val0[2]));
    Get5017H(3,i,&(val1[2]));
    Get5017H(3,i,&(val2[2]));
    Get5017H(3,i,&(val3[2]));
    Get5017H(3,i,&(val4[2]));
    Get5017H(3,i,&(val5[2]));
    Get5017H(3,i,&(val6[2]));
    Get5017H(3,i,&(val7[2]));

    ??



    PHP Code:

    $idx 
    0;
    while(
    $idx<100){
        for(
    $k=0;$k<8;$k++){
            
    $arrayName "val" $k "[" $idx "]";
            
    Get5017H(3,i,&($arrayName));
       }
        
    $idx++;

    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Location
    Scotland
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My body's a temple... and like those ancient Greek ones it's a ruin
    sweenster.co.uk


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •