0
int main(void) 
{
   string Name;
   int n;

   do
   {

      printf("Enter your name on screen:\n");

      name=GetString();

   }while(!isalpha(name)) ;

   n=strlen(name);

   for(int i=0;i < n;i++)

   {

       if(name[i]==' ')

       printf("%c%c\n",toupper(name[0]),toupper(name[i+1]));   

   }

}
1
  • What do you want to do? can you expalain what should be your expected Output of printf? – Wafeeq Jun 10 '16 at 13:05
1

The isalpha() function takes a single character as a parameter. The code is trying to stuff a string (multiple chars) down it's throat and it is choking on it, causing the seg fault.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .