There is pointer to string let say: char *p = "abcdef" I want to delete some of the chars.
Let say every second char, so i want to get *p="ace" my algorithm is something like:
int i=1,j=1
for(;p != '\0';p++,i++)
if (i % 2 ==0)
*(p - j++)= *p
*(p-j)='\0'
This algorithm is find the every second char of course but not matter how I try to write the "delete" process or there are compilation errors or the string is unchanged.
I start to believe there is no way to solve that issue without any malloc help. Again i need to do it on O(n) without any other STRINGS arrays.
*p(the char), notp(the pointer), with'\0'.