In the following program i just try to copy some string to the array and print it in another function.
I am getting segmentation fault .Could someone point out what i did wrong ?
  #include <stdio.h>
  #include <string.h>
  #define MAX_STR_LEN 20
  void print_str(char str[][],int count);
  int main()
  {
      char str[2][MAX_STR_LEN];
      strncpy(str[0],"hello",MAX_STR_LEN);
      strncpy(str[1],"world",MAX_STR_LEN);
      print_str(str,2);
      return 0;
  }
  void print_str(char str[][],int count)
  {
      int i;
      for(i=0;i<count;i++)
      printf("%s\n",str[i]);
  }


void print_str(char str[][],int count)-->void print_str(char str[][MAX_STR_LEN],int count)char str[][MAX_STR_LEN]. All but the most dominant dimension of an array of arrays as a parameter must be declared. There are probably hundreds of duplicates of this problem in one form or another, but generally the title is so diverse it is difficult to find them. One that is close would be this question, in particular the second answer.