Q:

Loop to iterate over an array based on a pointer?

If I have declared an external variable like extern char **seasons. Any tips on how to write a loop to iterate through this array? Assuming that a NULL value is the stopping condition?

A:

Assuming your array look like this :
const char *data[] = {"This", "is", "an", "array", "of", "strings", NULL};

You can iterate through it like this :
const char** seasons = data;
int i;
for(i = 0; seasons[i] != NULL; ++i) {
    printf("%s ", seasons[i]);
}

A:

#include <stdio.h>
#include <stdlib.h>

extern char **seasons;

int main(){
  int i = 0;
  while(seasons[i] != NULL){
    printf(seasons[i]);
    i++;
  }
  return 0;
}

