the idea is to trim the string starting from the value of offset and upto the value of size and return along with the new string return 1; and if it gets outside of code boundery to simply return 0 . This is my code:
int subPrint(char *s, int offset,int size){
char *m;
m = (s + offset);
while(size != 0){
m = (m + 1);
if(m == '\0')
return 0;
size--;
}
s = m;
return 1;
}
void subPrintTest(){
char s[20] = "INDUSTRIAL";
subPrint(s,2,4);
printf("%s",s);
}
void main(){
subPrintTest();
getch();
}
The problem is that its printing the original string s unchanged