following is the code to accept a string from user, but i get segmentation fault as soon i have finished entering a sentence i.e. as soon as i press the 'enter' key.
if anybody can help me enter the string, thanx!Code:#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main (void)
{
char str[50];
printf ("Enter string:\n");
fgets (str, sizeof str, stdin);
//further code
}