To find the substring in a given text.. C programm..

Posted by RBA on Stack Overflow See other posts from Stack Overflow or by RBA
Published on 2010-05-05T05:52:55Z Indexed on 2010/05/05 5:58 UTC
Read the original article Hit count: 213

Filed under:
|
char *substring(char *text, int position, int length)
{
   int i, j=0;
   char *temp ;

   for(i=position-1; i<position+length-1; i++)
   {
     temp[j++] = text[i];
   }
   temp[j] = '\0';

   return temp;
}

Hi What is the error in the following code.. I am trying to run this on Fedora Machine.. And its giving me a run-time error "Segmentation Fault". What is this error all about.. and why is it giving this error..

Thanks..

© Stack Overflow or respective owner

Related posts about c

    Related posts about pattern-matching