Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void xstrchr(char*,char);
int main()
{
char *target;
char s;
int l;
printf("Enter the target\t");
gets(target);
printf("%s\n",target); /*debug*/
printf("Enter the character\t");
scanf("%c",&s);
xstrchr(target,s);
}
void xstrchr(char *target,char s)
{
printf("\n%s\n",target); /*debugging*/
while(*target!='\0')
{
*target=s;
printf("%s\n",target);
*target++;
}
}
Aim : Replace all characters in a string with single character,
but the problem is "*target++" .
i am not able to print the entire replaced string
i have attached the execution to the post