--- In [email protected], Jefferson Mendoza
<[EMAIL PROTECTED]> wrote:
>
> C or C++? In C, a structure to hold records:
>
> typedef struct
> {
> int lat;
> int logAm;
> double logBmAm;
> } AzRec_t;
>
>
> static const AzRec_t azData[] =
> {
> {0, 727, 0.002949}, <==== there's an error here sir, declaration
> {1, 726, 0.002949}, incorrectly.. what wll i do??
This compiles ok for me (5 values only):
#include <stdio.h>
typedef struct
{
int lat;
int logAm;
double logBmAm;
} AzRec_t;
#define NUM_VALUES 5
static const AzRec_t azData[NUM_VALUES] =
{
{0, 727, 0.002949},
{1, 726, 0.002949},
{2, 725, 0.002946},
{3, 723, 0.002941},
{4, 719, 0.002935}
};
int main(void)
{
int i;
for (i = 0; i < NUM_VALUES; i++)
{
printf("lat=%d logAm=%d logBmAm=%f\n",
azData[i].lat,
azData[i].logAm,
azData[i].logBmAm);
}
return 0;
}
When run, output is:
lat=0 logAm=727 logBmAm=0.002949
lat=1 logAm=726 logBmAm=0.002949
lat=2 logAm=725 logBmAm=0.002946
lat=3 logAm=723 logBmAm=0.002941
lat=4 logAm=719 logBmAm=0.002935
BTW use 'Show Message Option' / 'Use Fixed Width Font' on the right
hand side of the Yahoo message window to display the code correctly.
Note: this is C, not C++.
John