# Thread: Looking for help with the array of structures problem :)

1. ## Looking for help with the array of structures problem :)

I'm trying to input the array of structs into the print_yearly_data function and then loop through the inputted array of structs, printing each individual structures data with the print_climate_data function.

Is there a way to do this using the current methods or do i need to learn something new.

Any help appreciated!

Code:
```#include <stdio.h>
#include <string.h>
#include <math.h>

void print_climate_data(struct climatedata a);
void print_yearly_data(struct climatedata b[]);

struct climatedata
{
char month[10];
float high;
float mean;
float low;
};

int main(void)
{
int m;

struct climatedata auck[13];

strcpy(auck[1].month, "Jan");
strcpy(auck[2].month, "Feb");
strcpy(auck[3].month, "Mar");
strcpy(auck[4].month, "Apr");
strcpy(auck[5].month, "May");
strcpy(auck[6].month, "Jun");
strcpy(auck[7].month, "Jul");
strcpy(auck[8].month, "Aug");
strcpy(auck[9].month, "Sep");
strcpy(auck[10].month, "Oct");
strcpy(auck[11].month, "Nov");
strcpy(auck[12].month, "Dec");

auck[1].high = 30.0f;
auck[2].high = 30.5f;
auck[3].high = 29.8f;
auck[4].high = 26.0f;
auck[5].high = 24.6f;
auck[6].high = 23.8f;
auck[7].high = 19.0f;
auck[8].high = 20.6f;
auck[9].high = 22.0f;
auck[10].high = 23.6f;
auck[11].high = 25.9f;
auck[12].high = 28.3f;

auck[1].low = 5.6f;
auck[2].low = 8.7f;
auck[3].low = 6.6f;
auck[4].low = 3.9f;
auck[5].low = 0.9f;
auck[6].low = -1.1f;
auck[7].low = -3.9f;
auck[8].low = -1.7f;
auck[9].low = 1.7f;
auck[10].low = -0.6f;
auck[11].low = 4.4f;
auck[12].low = 7.0f;

auck[1].mean = 19.1f;
auck[2].mean = 19.7f;
auck[3].mean = 18.4f;
auck[4].mean = 16.1f;
auck[5].mean = 14.0f;
auck[6].mean = 11.8f;
auck[7].mean = 10.9f;
auck[8].mean = 11.3f;
auck[9].mean = 12.7f;
auck[10].mean = 14.2f;
auck[11].mean = 15.7f;
auck[12].mean = 17.8f;
printf("Enter month number: ");
scanf("%d", &m);

print_climate_data(auck[m]);

return 0;
}

void print_climate_data(struct climatedata a)
{
printf("%s\n", a.month);
printf("Record High: %.1f C\n", a.high);
printf("Daily Mean: %.1f C\n", a.mean);
printf("Record Low: %.1f C\n\n", a.low);

}

void print_yearly_data(struct climatedata b[])
{
for (int i = 1; i > 13; i++)
{
print_climate_data(b[i]);
}
}```

2. > for (int i = 1; i > 13; i++)