so I have the following problem
Code:
if(buffer[i]== ' '&&buffer[i+1]==' '&&buffer[i+2]==' ')
{
buffer[i]= '*';
putchar(buffer[i]);
i = i + 2
continue;
}
putchar(buffer[i]);
i++;
}
this part of the code replaces 3 blanks with a *.
so my challenge is to replace all the array access into pointer-arithmetic
char *tmp0_pointer; // initialised in main function
Code:
if(*tmp0_pointer+1== ' '&&*tmp0_pointer+1==' ' &&*tmp0_pointer+2==' ' )
{
tmp0_pointer = buffer+i;
*tmp0_pointer= '*';
i = i + 2
continue;
}
tmp0_pointer = buffer+i;
putchar(*tmp0_pointer);
i++;
}
However the code below doesn't provide the same result.
I have a feeling I am not incrementing the pointers correctly.
Could someone help me out ?
Thank you in advance.