I am trying to pass an array of strings to a function and then the print it there. But it is giving segmentation fault.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *str[2];
for(int i=0;i<2;i++) {
scanf("%s",(str+i));
}
display(str);
}
void display(char **p)
{
for(int i=0;i<2;i++) {
printf("%s \n",p[i]);
}
}