heyas,

the replace fuction below is causing a segmentation fault -not sure why. this is really frustrating.. any help would be much appreciative.

the line causing the problem is:
Code:
(*newln) = new;
the whole code is below:
Code:
#include <stdio.h>

char *replace(char *text, char old, char new); 

int main(int argc, char *argv[])
{

        printf("%s", replace("Old sontence", 'o', 'e'));
        return 0;

}

char * replace(char *text, char old, char new)
{

        char *newln; 
       	 newln = text;
		while(*newln)
		{
               		 if (*newln == old)
                  			(*newln) = new;
            		newln++;
       		 }
        return text; 
}
thanks in advance

-twans