Program to replace particular character with * symbol
#include<stdio.h> #include<string.h> main() { char str1[50],str2[50],ch,*ptr; int i,j,index; printf("enter a string1\n"); scanf("%[^\n]s",str1); for(i=0,j=strlen(str1)-1;i<j;i++,j--) { ch=str1[1]; str1[1]=str1[4]=34; str1[4]=ch; } printf("ptr=%s",str1); }OutPut:
madan@madan-Lenovo-G570:~/madan$ ./a.out enter a string1 welcome ptr=w"lc"me