defining and iterating through array of strings in c

Viewed 45726

How can I define an array of string in c then iterate with a loop through the items in the array?

So far I have

char myStrings[][10] = { "one", "two", "three", "four", "five" };
// do I need to specify the "10" maximum length?
// also does it automatically create a null ending character after the string?

int i = 0;
for( i = 0; i < ; i++)
{
// I need to pass each string to  a function which accepts
// const char *
}
9 Answers

This might help

int main()
{
  int upp;

  int num;
  char password[20];
  int i;

  printf("Enter a Password (Must include a special char, a number, and an uppercase letter): \n");
  scanf(" %s", password);

  for (i=0;i<strlen(password);i++){
    if (isupper(password[i])){
      upp=1;

    }else if (isdigit(password[i])){
      num=1;
    }
  }if (num==1 && upp==1){
    printf("u may enter");
  }else
  printf("try again");

  return 0;
}
Related