www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/11/09:25:08

From: gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help: Array subscript not an integer...???
Date: 11 Mar 1997 11:21:30 GMT
Organization: Oxford University
Lines: 32
Message-ID: <5g3f7q$f8p@news.ox.ac.uk>
References: <33252AB5 DOT 2E8B AT postoffice DOT worldnet DOT att DOT net>
NNTP-Posting-Host: mc31.merton.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

James Shatto (Jcs DOT Shadow AT postoffice DOT worldnet DOT att DOT net) wrote:
: I'm trying to learn C and C++... I've written this in C and when it's
: compiled, I get an array subscript not an integer.  Any
: suggestions...???

: #define NUMH 96

: float height_table[NUMH] = {75.23, 75.35, 75.48, 75.60,
:                             75.72, 75.84, 75.96, 76.09,
:                             76.21, 76.33, 76.45, 76.56,
:                             76.68, 76.80, 76.92, 77.04,

: that's part of the data...
: when I try to use it with the following, it gives the error.
: array subscript not an integer.  I'm compiling with the gcc of djgpp...
:     strtoul(height_table[hf],NULL,hmf);
:     hmf = height_table[hf];

: both of these return the same error, hmf and hf are float integers.
: Please help...I can't get this thing to work...

`float integers'? float is a floating point (real) number, int is an integer
(whole number). There is no such thing as a float integer. Array subscripts
have to be of an integer-compatible type, which float isn't, so change hf
to type int, if possible.

If you are still confused, send me a longer code sample and I'll show you
what to change.

-- 
George Foot <gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk>
Merton College, Oxford.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019