following is the code to accept a string from user, but i get
segmentation fault as soon i have finished entering the string i.e. as
soon as i press the 'enter' key.
if anybody can help me enter the string, thanx!
segmentation fault as soon i have finished entering the string i.e. as
soon as i press the 'enter' key.
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
}
Comment