Thread: Variable declaration...

  1. #1
    Unregistered
    Guest

    Question Variable declaration...

    If I am converting a program from Fortran to C and I have a variable declared as INTEGER VAR(100,11) in my Fortran program, what or how should it be declared in my C program. The reason I am asking is that I am a novice C programmer and I need help.
    Thank you!
    Debra

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    What does 100 and 11 stand for?
    Code:
    int Var = 100;
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Unregistered
    Guest
    Those are the array dimensions.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If that's a 2D array, then it would be
    int var[100][11];

    Beware:
    As far as I know, Fortran uses indices 1..100, whereas C would use indices 0..99

  5. #5
    Unregistered
    Guest

    Smile

    Thanks Salem!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. Error in global variable declaration
    By JFonseka in forum C Programming
    Replies: 4
    Last Post: 04-11-2008, 10:50 PM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  4. variable declaration in H file
    By aleccher in forum C Programming
    Replies: 5
    Last Post: 04-02-2003, 06:18 PM
  5. variable declaration style
    By jdinger in forum C++ Programming
    Replies: 4
    Last Post: 05-20-2002, 01:32 PM