array of pointers passed as argument to fgets
Hi Everyone!
I am trying to use array of pointers to store strings and trying to take the input from the user for that I am using fgets,but it's throwing a segmentation fault.what is the right syntax when dealing with array of pointer with fgets?
Program :
Trying to store 3 strings:name,email id and subject,for this I am using char array of pointers.
Code:
#include<stdio.h>
int main()
{
char *info[3];
fputs("enter name:",stdout);
fgets(info[0],sizeof(info),stdin); // this line is throwing segmentation fault
fputs(info,stdout);
return 0;
}