Re: array question

From: Dan Chirillo (danchik5_at_hotmail.com)
Date: 11/21/04

  • Next message: Val: "Re: Floating Point Precision guidance."
    Date: Sun, 21 Nov 2004 21:15:19 GMT
    
    

    You can do it in VB (pre-.net versions): dim states(1 to 50 ) as string

    You cannot do it in C/C++.

    Hello beliavsky@aol.com,

    > David Lindauer <camille@bluegrass.net> wrote in message
    > news:<419D4EB2.EE08E42D@bluegrass.net>...
    >
    >> Surendra Singhi wrote:
    >>
    >>> Indy Tech wrote:
    >>>
    >>>> howdy all,
    >>>>
    >>>> I am getting back into programming after a long enough absence that
    >>>> the whole landscape has changed. I'm currently working with GCC
    >>>> 3.2.2 and Visual C++ 6.0.
    >>>>
    >>>> I have a vague memory of a way to define arrays that they do not
    >>>> contain a member array(0), but rather start at 1. Don't even
    >>>> recall what lamguage it is from. Can anyone tell me if there is a
    >>>> way to do this in C++?
    >>>>
    >>>> Thanks
    >>>>
    >>>> JP
    >>>>
    >>> I doubt if there is a way to do that in C++ or C.
    >>> Definitely not in Basic.
    >>> Maybe in fortran, I am not sure.
    > In Fortran, the lower bound of arrays is 1 by default, but other
    > integers can be specified.
    >
    > real x(3),y(-1:2)
    >
    > declares arrays with elements [x(1),x(2),x(3)] and
    > [y(-1),y(0),y(1),y(2)]
    >
    > This generalizes to multidimensional arrays. Fortran, especially
    > Fortran 90 and later versions, is better at handling arrays than
    > almost any other language.
    >


  • Next message: Val: "Re: Floating Point Precision guidance."

    Relevant Pages

    • Re: bivariate interpolation
      ... > interpolated using Akima's Bivariate Interpolation for Smooth Surface ... > rewrite the code form its original Fortran V to much cleaner C. ... > The routine has numerous 2-dimensional arrays that are being accessed ...
      (comp.lang.c)
    • Re: seeking advice for "translate" Fortran code to Java code
      ... redefine a common block as needed for each subroutine. ... Still, Java has no pointers, so I ... Java arrays are always what C would call arrays of pointers ... Fortran intrinsics in Java appropriately. ...
      (comp.lang.fortran)
    • Re: INTERFACE problem
      ... I have an integer at Fortran side, pass it by reference to C function, treat here as pointer, allocate memory and this C-pointer at Fortran side now is an integer which has represents address allocated at C side. ... I did something like this many years ago to allow dynamic allocation ... Then it was converted into a subroutine with the arrays and ... it called the sub by way of Pascal with those "pointers". ...
      (comp.lang.fortran)
    • Re: couple c and fortran 95
      ... I would always put middleware layer at either side of the interface not just ... Fortran by Reference. ... arrays or by passing a pointer from the C side of the interface. ... C strings are null terminated arrays of character; ...
      (comp.lang.fortran)
    • Re: Cracking DES with C++ is faster than Java?
      ... > C doesn't have multidimensional arrays, ... you must use pointers to pointers instead, ... properties from Fortran (efficient code, separate compilation, ... However C didn't borrow object orientation ...
      (comp.lang.java)