Thanks for the reply. Here is a small version of what I'm trying to accomplish:
Code:
#include <stdio.h>
#include <string.h>
int main(void)
{
char s1[50], s2[50], *ptr;
int i;
printf (" Enter String : \n");
scanf (" %s ", s1);
printf (" New string : \n");
ptr = s1;
for (i = 0; s1[i] != '\0'; i++)
{
if (s1[i] == 'x' || s1[i] == 'y' || s1[i] == 'z')
{
ptr = &s1[i];
strcat(s2, *ptr);
}
printf (" %s \n", *ptr); //Just to be clear, lets say the user entered the string "abcxyz", the output would be "xyz".
}
}
It gives me the error: (using dev-cpp if that means anything)
[Error] invalid conversion from 'char' to 'const char*' [-fpermissive]
[Note] initializing argument 2 of 'char* strcat(char*, const char*)'