Hi,
I'm writing a function to output the substring of a given string with its start and end index. But i seem to be getting seg faults with this. Can anyone help me, plz!
here's my code:
Where 's' is the given string, and 'x' is the desired substr output.... start & end are the string indices.Code:char *substring(char *s, int start, int end){ int i; char *x; for(i=start; i<=end; i++){ x[i] = s[i]; } return x; }
THX!



LinkBack URL
About LinkBacks




