Skip to content

Commit

Permalink
Merge pull request #2517 from gsjaardema/patch-55
Browse files Browse the repository at this point in the history
For loop initial declarations are only allowed in C99 mode
  • Loading branch information
WardF authored Sep 26, 2022
2 parents 94bac62 + 90ed6b8 commit 4a00921
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nc_test4/tst_virtual_datasets.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ static void
create_dataset_a() {
hsize_t dims[1] = {VARIABLE_SIZE};
float data[VARIABLE_SIZE];
for(size_t i = 0; i < VARIABLE_SIZE; ++i) {
size_t i;
for(i = 0; i < VARIABLE_SIZE; ++i) {
data[i] = (float)i;
}

Expand Down Expand Up @@ -51,6 +52,7 @@ create_dataset_b() {

int read_back_contents(const char* filename) {
int ncid, varid, ndims;
size_t i;
float data[VARIABLE_SIZE];

char var_name[NC_MAX_NAME+1];
Expand All @@ -63,7 +65,7 @@ int read_back_contents(const char* filename) {
if (nc_inq_var(ncid, varid, var_name, &var_type, &ndims, dimids_var, &natts)) ERR;
if (nc_get_var_float(ncid, varid, data)) ERR;
printf("\t %s: ", var_name);
for (size_t i = 0; i < VARIABLE_SIZE; ++i) {
for (i = 0; i < VARIABLE_SIZE; ++i) {
printf("%f, ", data[i]);
}
printf("\n");
Expand Down

0 comments on commit 4a00921

Please sign in to comment.